Skip to content

Commit 9b899c7

Browse files
committed
escape attribute value for lang
Signed-off-by: BinotaLIU <binota@binota.org>
1 parent bdd2de7 commit 9b899c7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

public/js/extra.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { stripTags } from '../../utils/string'
1616
import getUIElements from './lib/editor/ui-elements'
1717
import { emojifyImageDir } from './lib/editor/constants'
1818

19+
import { escapeAttrValue } from './render'
20+
1921
import markdownit from 'markdown-it'
2022
import markdownitContainer from 'markdown-it-container'
2123

@@ -734,8 +736,8 @@ export function exportToHTML (view) {
734736
html: src[0].outerHTML,
735737
'ui-toc': toc.html(),
736738
'ui-toc-affix': tocAffix.html(),
737-
lang: (md && md.meta && md.meta.lang) ? `lang="${md.meta.lang}"` : null,
738-
dir: (md && md.meta && md.meta.dir) ? `dir="${md.meta.dir}"` : null
739+
lang: (md && md.meta && md.meta.lang) ? `lang="${escapeAttrValue(md.meta.lang)}"` : null,
740+
dir: (md && md.meta && md.meta.dir) ? `dir="${escapeAttrValue(md.meta.dir)}"` : null
739741
}
740742
const html = template(context)
741743
// console.log(html);

0 commit comments

Comments
 (0)