escape attribute value for lang

Signed-off-by: BinotaLIU <binota@binota.org>
This commit is contained in:
BinotaLIU 2020-04-10 22:40:28 +08:00
parent bdd2de72ba
commit 9b899c7778
No known key found for this signature in database
GPG Key ID: 87C590ECC1F5314E
1 changed files with 4 additions and 2 deletions

View File

@ -16,6 +16,8 @@ import { stripTags } from '../../utils/string'
import getUIElements from './lib/editor/ui-elements'
import { emojifyImageDir } from './lib/editor/constants'
import { escapeAttrValue } from './render'
import markdownit from 'markdown-it'
import markdownitContainer from 'markdown-it-container'
@ -734,8 +736,8 @@ export function exportToHTML (view) {
html: src[0].outerHTML,
'ui-toc': toc.html(),
'ui-toc-affix': tocAffix.html(),
lang: (md && md.meta && md.meta.lang) ? `lang="${md.meta.lang}"` : null,
dir: (md && md.meta && md.meta.dir) ? `dir="${md.meta.dir}"` : null
lang: (md && md.meta && md.meta.lang) ? `lang="${escapeAttrValue(md.meta.lang)}"` : null,
dir: (md && md.meta && md.meta.dir) ? `dir="${escapeAttrValue(md.meta.dir)}"` : null
}
const html = template(context)
// console.log(html);