Skip to content

Commit

Permalink
🖌 Add support for aside directive (#341)
Browse files Browse the repository at this point in the history
Co-authored-by: Rowan Cockett <[email protected]>
  • Loading branch information
agoose77 and rowanc1 authored Mar 21, 2024
1 parent 993f4a8 commit 6d116bd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/early-nails-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-to-react': minor
---

Add support for margin directives
12 changes: 12 additions & 0 deletions packages/myst-to-react/src/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ type CaptionNumber = {
identifier: string;
};

type Aside = {
type: 'aside';
};

type BasicNodeRenderers = {
text: NodeRenderer<spec.Text>;
span: NodeRenderer<GenericNode>;
Expand Down Expand Up @@ -80,6 +84,7 @@ type BasicNodeRenderers = {
definitionList: NodeRenderer<DefinitionList>;
definitionTerm: NodeRenderer<DefinitionTerm>;
definitionDescription: NodeRenderer<DefinitionDescription>;
aside: NodeRenderer<Aside>;
};

const BASIC_RENDERERS: BasicNodeRenderers = {
Expand Down Expand Up @@ -363,6 +368,13 @@ const BASIC_RENDERERS: BasicNodeRenderers = {
</dd>
);
},
aside({ node }) {
return (
<aside className="text-sm lg:h-0 col-margin-right">
<MyST ast={node.children} />
</aside>
);
},
};

export default BASIC_RENDERERS;

0 comments on commit 6d116bd

Please sign in to comment.