mirror of https://github.com/status-im/codimd.git
Fix meta break setting in slide mode
When `RevealMarkdown.initialize` is called, it use `md.render` to render markdown, but no until we parse meta, the md.options.breaks would be default value we set in extra.js. So this commit move forward the whole meta parsing block. Ensure line break setting changed before `md.render` get called. Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
This commit is contained in:
parent
fd155fa74d
commit
56b669a027
|
@ -49,6 +49,15 @@ const deps = [{
|
|||
}
|
||||
}]
|
||||
|
||||
// options from yaml meta
|
||||
const meta = JSON.parse($('#meta').text())
|
||||
// breaks
|
||||
if (typeof meta.breaks === 'boolean') {
|
||||
md.options.breaks = meta.breaks
|
||||
} else {
|
||||
md.options.breaks = window.defaultUseHardbreak
|
||||
}
|
||||
|
||||
const slideOptions = {
|
||||
separator: '^(\r\n?|\n)---(\r\n?|\n)$',
|
||||
verticalSeparator: '^(\r\n?|\n)----(\r\n?|\n)$'
|
||||
|
@ -70,8 +79,6 @@ const defaultOptions = {
|
|||
dependencies: deps
|
||||
}
|
||||
|
||||
// options from yaml meta
|
||||
const meta = JSON.parse($('#meta').text())
|
||||
var options = meta.slideOptions || {}
|
||||
|
||||
if (Object.hasOwnProperty.call(options, 'spotlight')) {
|
||||
|
@ -103,12 +110,6 @@ if (meta.dir && typeof meta.dir === 'string' && meta.dir === 'rtl') {
|
|||
} else {
|
||||
options.rtl = false
|
||||
}
|
||||
// breaks
|
||||
if (typeof meta.breaks === 'boolean' && !meta.breaks) {
|
||||
md.options.breaks = false
|
||||
} else {
|
||||
md.options.breaks = true
|
||||
}
|
||||
|
||||
// options from URL query string
|
||||
const queryOptions = Reveal.getQueryHash() || {}
|
||||
|
|
Loading…
Reference in New Issue