mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-15 12:31:15 +00:00
fixed an issue with leading newlines
This commit is contained in:
parent
36e19ea08f
commit
7fbadc711d
1 changed files with 4 additions and 2 deletions
|
|
@ -88,7 +88,9 @@ futoji.addTransformer({
|
|||
let formatted = formatCode(unescapeHTML(text))
|
||||
|
||||
let highlighted
|
||||
if(formatted.lang in hljs.listLanguages()) {
|
||||
if(formatted.lang.length === 0) {
|
||||
return `<div class="codeblock"><code>${escapeHTML(formatted.code)}</code></div>`
|
||||
} else if(hljs.listLanguages().includes(formatted.lang)) {
|
||||
highlighted = hljs.highlight(formatted.lang, formatted.code, true)
|
||||
} else {
|
||||
highlighted = hljs.highlightAuto(formatted.code)
|
||||
|
|
@ -134,7 +136,7 @@ function formatCode(text) {
|
|||
|
||||
return {
|
||||
lang: '',
|
||||
code: text
|
||||
code: text.replace(/^\n/, '')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue