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>`
|
||||
}
|
||||
|
||||
// renderer.code = (code: string, language: string) => {
|
||||
// return renderToStaticMarkup(
|
||||
// <pre>
|
||||
// {/* {title && <code>{title} </code>} */}
|
||||
// {/* {language && title && <code style={{}}> {language} </code>} */}
|
||||
// <Code
|
||||
// language={language}
|
||||
// // title={title}
|
||||
// code={code}
|
||||
// // highlight={highlight}
|
||||
// />
|
||||
// </pre>
|
||||
// )
|
||||
// }
|
||||
renderer.code = (code: string, language: string) => {
|
||||
return renderToStaticMarkup(
|
||||
<pre>
|
||||
{/* {title && <code>{title} </code>} */}
|
||||
{/* {language && title && <code style={{}}> {language} </code>} */}
|
||||
<Code
|
||||
language={language}
|
||||
// title={title}
|
||||
code={code}
|
||||
// highlight={highlight}
|
||||
/>
|
||||
</pre>
|
||||
)
|
||||
}
|
||||
|
||||
marked.setOptions({
|
||||
gfm: true,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { marked } from 'marked'
|
||||
import { marked, Lexer } from 'marked'
|
||||
import Highlight, { defaultProps, Language, } from 'prism-react-renderer'
|
||||
import { renderToStaticMarkup } from 'react-dom/server'
|
||||
|
||||
|
@ -95,8 +95,7 @@ const Code = ({ code, language, highlight, title, ...props }: {
|
|||
if (!language)
|
||||
return (
|
||||
<>
|
||||
<code {...props} dangerouslySetInnerHTML={{ __html: code }
|
||||
} />
|
||||
<code {...props} dangerouslySetInnerHTML={{ __html: code }} />
|
||||
</>
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue