Skip to content

Commit

Permalink
馃懀 Use provided renderers in footnotes (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 committed May 9, 2023
1 parent dc9fd53 commit c0f13f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-baboons-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-to-react': patch
---

Use renderers in footnote provider
9 changes: 5 additions & 4 deletions packages/myst-to-react/src/footnotes.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import type { GenericParent } from 'myst-common';
import type { NodeRenderer } from '@myst-theme/providers';
import { useReferences } from '@myst-theme/providers';
import { XRefProvider, useNodeRenderers, useReferences } from '@myst-theme/providers';
import { useParse } from '.';
import { ClickPopover } from './components/ClickPopover';
import { select } from 'unist-util-select';

export function FootnoteDefinition({ identifier }: { identifier: string }) {
function FootnoteDefinition({ identifier }: { identifier: string }) {
const references = useReferences();
const renderers = useNodeRenderers();
const node =
(references as any)?.footnotes?.[identifier] ??
select(`footnoteDefinition[identifier=${identifier}]`, references?.article);
const children = useParse(node as GenericParent);
return <>{children}</>;
const children = useParse(node as GenericParent, renderers);
return <XRefProvider>{children}</XRefProvider>;
}

export const FootnoteReference: NodeRenderer = (node) => {
Expand Down

0 comments on commit c0f13f8

Please sign in to comment.