Keep some HTML tag when convert markdown to HTML #658
Answered
by
ChristianMurphy
letanloc1998
asked this question in
Q&A
-
import React, { useState, useEffect } from "react";
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm'; // remark plugin to support GitHub Flavored Markdown
import introduce from 'markdown/1. Introduce.md';
function App() {
const [markdownSource, setMarkdownSource] = useState('');
// fetch(introduce)
// .then((res) => res.text())
// .then((text) => setMarkdownSource(text));
// const readFile = async (file) => {
// let response = await fetch(file);
// return await response.text;
// }
useEffect(
() => {
fetch(introduce)
.then((res) => res.text())
.then((text) => setMarkdownSource(text));
}
, []
);
return (
<ReactMarkdown plugins={[remarkGfm]} children={markdownSource} />
);
}
export default App; I want to keep some html code when convert from markdown to html, does any props config it I want to keep <details>
<summary><br>tree /f /a > tree.txt</summary>
...
</details> Expect result... |
Beta Was this translation helpful? Give feedback.
Answered by
ChristianMurphy
Mar 12, 2021
Replies: 1 comment 3 replies
-
Have you tried https://github.com/remarkjs/react-markdown#appendix-a-html-in-markdown ? |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
ChristianMurphy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you tried https://github.com/remarkjs/react-markdown#appendix-a-html-in-markdown ?