markdown: re-enable code highlighting

This commit is contained in:
Max Leiter 2022-03-24 14:09:36 -07:00
parent 41238cb79f
commit b93e42a347
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA
2 changed files with 16 additions and 17 deletions

View file

@ -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,

View file

@ -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 }} />
} />
</> </>
) )