Use defaultUseHardbreak config when render

Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
This commit is contained in:
Yukai Huang 2019-10-20 14:15:03 +08:00
parent 495b65e3b9
commit fd155fa74d
No known key found for this signature in database
GPG Key ID: D4D3B2F0E99D4914
1 changed files with 5 additions and 5 deletions

View File

@ -195,7 +195,7 @@ export function isValidURL (str) {
export function parseMeta (md, edit, view, toc, tocAffix) {
let lang = null
let dir = null
let breaks = true
let breaks = window.defaultUseHardbreak
if (md && md.meta) {
const meta = md.meta
lang = meta.lang
@ -225,10 +225,10 @@ export function parseMeta (md, edit, view, toc, tocAffix) {
tocAffix.removeAttr('dir')
}
// breaks
if (typeof breaks === 'boolean' && !breaks) {
md.options.breaks = false
if (typeof breaks === 'boolean') {
md.options.breaks = breaks
} else {
md.options.breaks = true
md.options.breaks = window.defaultUseHardbreak
}
}
@ -979,7 +979,7 @@ function highlightRender (code, lang) {
export const md = markdownit('default', {
html: true,
breaks: true,
breaks: window.defaultUseHardbreak,
langPrefix: '',
linkify: true,
typographer: true,