[react-markdown] How to ember GitHub gist in the react-markdown component #894
-
I tried adding a script tag to my markdown file and then sending the code to the component but instead of loading the script it directly prints is a script tag. I also tried it using various plugins but I am not able to ember my GitHub gist to the markdown file and then compile it via the component. Is there any way to add GitHub gist to the markdown file and render it using the remarkjs/react-markdown library? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It should be possible, it's hard to comment on the approach you've tried given you haven't provided a lot of details. For a recommended approach, it sounds like you want to embed a Gist part way in a document? an example document could look something like: # Code Example
::gist[ES Modules]{#a39789f98801d908bbc7ff3ecc99d99c} There are also some previous question around embedding content with directives which could offer some insights: https://github.com/remarkjs/remark/discussions?discussions_q=react-markdown+directive Then use a component to render https://github.com/remarkjs/react-markdown#appendix-b-components |
Beta Was this translation helpful? Give feedback.
It should be possible,
it's hard to comment on the approach you've tried given you haven't provided a lot of details.
See https://github.com/remarkjs/.github/blob/main/support.md#asking-quality-questions for some guidance on framing the question so others can help, and if you want help on your specific approach consider sharing a codesandbox with a runnable example https://codesandbox.io/s/react-markdown-debug-9n4eg is a good starter.
For a recommended approach, it sounds like you want to embed a Gist part way in a document?
If so, consider using directives https://github.com/remarkjs/remark-directive
an example document could look something like: