mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -05:00
Replace deprecated highlight.js syntax (#1295)
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
c867673072
commit
1eea135a9d
1 changed files with 1 additions and 1 deletions
|
@ -42,7 +42,7 @@ export const HighlightedCode: React.FC<HighlightedCodeProps> = ({ code, language
|
||||||
import(/* webpackChunkName: "highlight.js" */ '../../../../common/hljs/hljs').then((hljs) => {
|
import(/* webpackChunkName: "highlight.js" */ '../../../../common/hljs/hljs').then((hljs) => {
|
||||||
const languageSupported = (lang: string) => hljs.default.listLanguages()
|
const languageSupported = (lang: string) => hljs.default.listLanguages()
|
||||||
.includes(lang)
|
.includes(lang)
|
||||||
const unreplacedCode = !!language && languageSupported(language) ? hljs.default.highlight(language, code).value : escapeHtml(code)
|
const unreplacedCode = !!language && languageSupported(language) ? hljs.default.highlight(code, { language }).value : escapeHtml(code)
|
||||||
const replacedDom = replaceCode(unreplacedCode)
|
const replacedDom = replaceCode(unreplacedCode)
|
||||||
.map((line, index) => (
|
.map((line, index) => (
|
||||||
<Fragment key={ index }>
|
<Fragment key={ index }>
|
||||||
|
|
Loading…
Reference in a new issue