Skip to content

Commit

Permalink
⌨️ Add keyboard renderer (#334)
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 6d116bd commit bd6bacc
Showing 1 changed file with 12 additions and 0 deletions.
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 @@ -46,6 +46,10 @@ type Aside = {
type: 'aside';
};

type Keyboard = {
type: 'keyboard';
};

type BasicNodeRenderers = {
text: NodeRenderer<spec.Text>;
span: NodeRenderer<GenericNode>;
Expand Down Expand Up @@ -79,6 +83,7 @@ type BasicNodeRenderers = {
captionNumber: NodeRenderer<CaptionNumber>;
delete: NodeRenderer<Delete>;
underline: NodeRenderer<Underline>;
keyboard: NodeRenderer<Keyboard>;
smallcaps: NodeRenderer<SmallCaps>;
// definitions
definitionList: NodeRenderer<DefinitionList>;
Expand Down Expand Up @@ -375,6 +380,13 @@ const BASIC_RENDERERS: BasicNodeRenderers = {
</aside>
);
},
keyboard({ node }) {
return (
<kbd>
<MyST ast={node.children} />
</kbd>
);
},
};

export default BASIC_RENDERERS;

0 comments on commit bd6bacc

Please sign in to comment.