Skip to content

Commit

Permalink
🎨 Add basic div/span functionality to renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 committed Nov 14, 2023
1 parent d812cf3 commit 356bc2f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/empty-jobs-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-to-react': patch
---

Add div and span nodes
11 changes: 9 additions & 2 deletions packages/myst-to-react/src/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type CaptionNumber = {
type BasicNodeRenderers = {
text: NodeRenderer<spec.Text>;
span: NodeRenderer<GenericNode>;
div: NodeRenderer<GenericNode>;
strong: NodeRenderer<spec.Strong>;
emphasis: NodeRenderer<spec.Emphasis>;
link: NodeRenderer<spec.Link>;
Expand Down Expand Up @@ -99,13 +100,19 @@ const BASIC_RENDERERS: BasicNodeRenderers = {
);
},
span({ node }) {
// style={node.style}
return (
<span>
<span className={node.class} style={node.style}>
<MyST ast={node.children} />
</span>
);
},
div({ node }) {
return (
<div className={node.class} style={node.style}>
<MyST ast={node.children} />
</div>
);
},
delete({ node }) {
return (
<del>
Expand Down

0 comments on commit 356bc2f

Please sign in to comment.