Skip to content

Commit 2ff266d

Browse files
authored
Merge pull request #15 from delschlangen/claude/enhance-bluebook-citations-uO8FO
Render citation italics as actual italics instead of asterisks
2 parents 993ab6b + f8a3a98 commit 2ff266d

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

frontend/src/components/CitationEditor.jsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import React, { useState, useEffect } from 'react';
22

3+
// Render markdown-style *italics* as actual italics
4+
function renderCitation(text) {
5+
if (!text) return null;
6+
const parts = text.split(/(\*[^*]+\*)/g);
7+
return parts.map((part, i) => {
8+
if (part.startsWith('*') && part.endsWith('*')) {
9+
return <em key={i}>{part.slice(1, -1)}</em>;
10+
}
11+
return part;
12+
});
13+
}
14+
315
export default function CitationEditor({ citation, suggestion, onSave, onLookup, onCancel }) {
416
const [formData, setFormData] = useState({});
517
const [lookupResults, setLookupResults] = useState(null);
@@ -209,7 +221,7 @@ export default function CitationEditor({ citation, suggestion, onSave, onLookup,
209221
{suggestion?.suggested_form && (
210222
<div className="p-3 bg-blue-50 border border-blue-100 rounded-lg">
211223
<p className="text-xs font-medium text-blue-700 mb-1">Formatted suggestion:</p>
212-
<p className="text-sm font-mono text-blue-800">{suggestion.suggested_form}</p>
224+
<p className="text-sm font-mono text-blue-800">{renderCitation(suggestion.suggested_form)}</p>
213225
</div>
214226
)}
215227

frontend/src/components/CitationList.jsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import React from 'react';
22

3+
// Render markdown-style *italics* as actual italics
4+
function renderCitation(text) {
5+
if (!text) return null;
6+
const parts = text.split(/(\*[^*]+\*)/g);
7+
return parts.map((part, i) => {
8+
if (part.startsWith('*') && part.endsWith('*')) {
9+
return <em key={i}>{part.slice(1, -1)}</em>;
10+
}
11+
return part;
12+
});
13+
}
14+
315
const statusColors = {
416
complete: 'bg-green-100 text-green-800',
517
incomplete: 'bg-yellow-100 text-yellow-800',
@@ -76,7 +88,7 @@ export default function CitationList({ citations, shortFormSuggestions, onSelect
7688
Suggested ({suggestion.short_form_type}):
7789
</p>
7890
<p className="text-sm text-green-800 font-mono">
79-
{suggestion.suggested_form}
91+
{renderCitation(suggestion.suggested_form)}
8092
</p>
8193
{suggestion.explanation && (
8294
<p className="text-xs text-green-600 mt-1">{suggestion.explanation}</p>

0 commit comments

Comments
 (0)