Skip to content

Commit

Permalink
🎨 Update citation styles (#236)
Browse files Browse the repository at this point in the history
This allows citations in a group to be more than a `cite` html element.
  • Loading branch information
rowanc1 authored Sep 26, 2023
1 parent 55f7d0f commit bf66da0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changeset/silver-bananas-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'myst-to-react': patch
'@myst-theme/styles': patch
---

Allow citations to be elements other than `cite` (e.g. a Figure 1 reference is a span element.)
2 changes: 1 addition & 1 deletion packages/myst-to-react/src/cite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const Cite = ({
const doiUrl = doiString ? doi.buildUrl(doiString as string) : null;
return (
<HoverPopover openDelay={300} card={<CiteChild html={html} />}>
<cite className="hover-link">
<cite>
{doiUrl && (
<a href={doiUrl} target="_blank" rel="noreferrer" className="hover-link">
{children}
Expand Down
6 changes: 3 additions & 3 deletions styles/citations.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
cite {
font-style: normal;
}
.cite-group.parenthetical cite::after {
.cite-group.parenthetical > *::after {
content: ';\00a0';
}
.cite-group.narrative cite::after {
.cite-group.narrative > *::after {
content: ',\00a0';
}
.cite-group > cite:last-of-type::after {
.cite-group > *:last-of-type::after {
content: '';
}
.cite-group.parenthetical:before {
Expand Down

0 comments on commit bf66da0

Please sign in to comment.