Skip to content

Commit

Permalink
🎨 Fix citation link styles (#252)
Browse files Browse the repository at this point in the history
- Add `<span>` as a known element type
  • Loading branch information
rowanc1 authored Oct 24, 2023
1 parent 29fc03a commit 6db9952
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fifty-bears-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-to-react': patch
---

Add span and fix citation link styles
9 changes: 9 additions & 0 deletions packages/myst-to-react/src/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type CaptionNumber = {

type BasicNodeRenderers = {
text: NodeRenderer<spec.Text>;
span: NodeRenderer<GenericNode>;
strong: NodeRenderer<spec.Strong>;
emphasis: NodeRenderer<spec.Emphasis>;
link: NodeRenderer<spec.Link>;
Expand Down Expand Up @@ -82,6 +83,14 @@ const BASIC_RENDERERS: BasicNodeRenderers = {
text({ node }) {
return <>{node.value}</>;
},
span({ node }) {
// style={node.style}
return (
<span>
<MyST ast={node.children} />
</span>
);
},
delete({ node }) {
return (
<del>
Expand Down
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 @@ -54,7 +54,7 @@ export const Cite = ({
{children}
</a>
)}
{!doiUrl && children}
{!doiUrl && <span className="hover-link">{children}</span>}
</cite>
</HoverPopover>
);
Expand Down

0 comments on commit 6db9952

Please sign in to comment.