markdown: re-enable code highlighting
This commit is contained in:
parent
41238cb79f
commit
b93e42a347
2 changed files with 16 additions and 17 deletions
|
@ -60,20 +60,20 @@ renderer.listitem = (text, task, checked) => {
|
||||||
return `<li>${text}</li>`
|
return `<li>${text}</li>`
|
||||||
}
|
}
|
||||||
|
|
||||||
// renderer.code = (code: string, language: string) => {
|
renderer.code = (code: string, language: string) => {
|
||||||
// return renderToStaticMarkup(
|
return renderToStaticMarkup(
|
||||||
// <pre>
|
<pre>
|
||||||
// {/* {title && <code>{title} </code>} */}
|
{/* {title && <code>{title} </code>} */}
|
||||||
// {/* {language && title && <code style={{}}> {language} </code>} */}
|
{/* {language && title && <code style={{}}> {language} </code>} */}
|
||||||
// <Code
|
<Code
|
||||||
// language={language}
|
language={language}
|
||||||
// // title={title}
|
// title={title}
|
||||||
// code={code}
|
code={code}
|
||||||
// // highlight={highlight}
|
// highlight={highlight}
|
||||||
// />
|
/>
|
||||||
// </pre>
|
</pre>
|
||||||
// )
|
)
|
||||||
// }
|
}
|
||||||
|
|
||||||
marked.setOptions({
|
marked.setOptions({
|
||||||
gfm: true,
|
gfm: true,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { marked } from 'marked'
|
import { marked, Lexer } from 'marked'
|
||||||
import Highlight, { defaultProps, Language, } from 'prism-react-renderer'
|
import Highlight, { defaultProps, Language, } from 'prism-react-renderer'
|
||||||
import { renderToStaticMarkup } from 'react-dom/server'
|
import { renderToStaticMarkup } from 'react-dom/server'
|
||||||
|
|
||||||
|
@ -95,8 +95,7 @@ const Code = ({ code, language, highlight, title, ...props }: {
|
||||||
if (!language)
|
if (!language)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<code {...props} dangerouslySetInnerHTML={{ __html: code }
|
<code {...props} dangerouslySetInnerHTML={{ __html: code }} />
|
||||||
} />
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue