-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(zbugs): support mermaid diagrams
- Loading branch information
Showing
3 changed files
with
7,773 additions
and
19,413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
import MarkdownBase from 'react-markdown'; | ||
import remarkGfm from 'remark-gfm'; | ||
import mermaid from 'remark-mermaidjs'; | ||
|
||
// We have to use an old version of remark-mermaidjs until they resolve this issue: remarkjs/react-markdown#680 | ||
// Alternatively, just do this ourselves and remove `react-markdown`. | ||
// It isn't that hard: https://github.com/tantaman/strut/blob/main/src/components/editor/well/WellSlidePreview.tsx#L63-L79 | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
type TODO_old_mermaid = any; | ||
|
||
/** | ||
* Do not import this component directly. Use `Markdown` instead. | ||
*/ | ||
export default function Markdown({children}: {children: string}) { | ||
return <MarkdownBase rehypePlugins={[remarkGfm]}>{children}</MarkdownBase>; | ||
return ( | ||
<MarkdownBase remarkPlugins={[remarkGfm, mermaid as TODO_old_mermaid]}> | ||
{children} | ||
</MarkdownBase> | ||
); | ||
} |
Oops, something went wrong.