Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Update citation styles #236

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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