markdown: re-enable code highlighting

This commit is contained in:
Max Leiter 2022-03-24 14:09:36 -07:00
parent 41238cb79f
commit b93e42a347
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
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>`
}
// 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,

View file

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