From 8f5a43be22d4e8e4d629aa2ff306ab16d91c8220 Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Mon, 25 Sep 2023 20:50:07 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Update=20citation=20styles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows citations in a group to be more than a `cite` html element. --- .changeset/silver-bananas-kiss.md | 6 ++++++ packages/myst-to-react/src/cite.tsx | 2 +- styles/citations.css | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/silver-bananas-kiss.md diff --git a/.changeset/silver-bananas-kiss.md b/.changeset/silver-bananas-kiss.md new file mode 100644 index 000000000..c5162925c --- /dev/null +++ b/.changeset/silver-bananas-kiss.md @@ -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.) diff --git a/packages/myst-to-react/src/cite.tsx b/packages/myst-to-react/src/cite.tsx index 83c272577..eddc6758f 100644 --- a/packages/myst-to-react/src/cite.tsx +++ b/packages/myst-to-react/src/cite.tsx @@ -48,7 +48,7 @@ export const Cite = ({ const doiUrl = doiString ? doi.buildUrl(doiString as string) : null; return ( }> - + {doiUrl && ( {children} diff --git a/styles/citations.css b/styles/citations.css index 303a3ed8d..fc8ea1a42 100644 --- a/styles/citations.css +++ b/styles/citations.css @@ -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 {