feat: Optional linebreaks + mathjax processing

This commit is contained in:
NGPixel 2017-06-24 16:08:55 -04:00 committed by Nicolas Giard
parent 3d9aa18c05
commit 919afb46e2
5 changed files with 38 additions and 2 deletions

View File

@ -134,6 +134,15 @@ git:
# Whether to use user email as author in commits
showUserEmail: true
# ---------------------------------------------------------------------
# Features
# ---------------------------------------------------------------------
# You can enable / disable specific features below
features:
linebreaks: true
mathjax: true
# ---------------------------------------------------------------------
# External Logging
# ---------------------------------------------------------------------

View File

@ -132,6 +132,15 @@ git:
# Whether to use user email as author in commits
showUserEmail: true
# ---------------------------------------------------------------------
# Features
# ---------------------------------------------------------------------
# You can enable / disable specific features below
features:
linebreaks: true
mathjax: true
# ---------------------------------------------------------------------
# External Logging
# ---------------------------------------------------------------------

View File

@ -132,6 +132,15 @@ git:
# Whether to use user email as author in commits
showUserEmail: $(WIKI_SHOW_USER_EMAIL)
# ---------------------------------------------------------------------
# Features
# ---------------------------------------------------------------------
# You can enable / disable specific features below
features:
linebreaks: true
mathjax: true
# ---------------------------------------------------------------------
# External Logging
# ---------------------------------------------------------------------

View File

@ -49,6 +49,7 @@ defaults:
serverEmail: wiki@example.com
showUserEmail: true
features:
linebreaks: true
mathjax: true
externalLogging:
bugsnap: false

View File

@ -21,6 +21,7 @@ const mdRemove = require('remove-markdown')
var mkdown = md({
html: true,
breaks: appconfig.features.linebreaks,
linkify: true,
typography: true,
highlight(str, lang) {
@ -53,7 +54,10 @@ var mkdown = md({
tabWidth: 4
})
.use(mdAttrs)
.use(mdMathjax)
if (appconfig.features.mathjax) {
mkdown.use(mdMathjax)
}
// Rendering rules
@ -296,7 +300,11 @@ const parseContent = (content) => {
// Mathjax Post-processor
return processMathjax(cr.html())
if (appconfig.features.mathjax) {
return processMathjax(cr.html())
} else {
return Promise.resolve(cr.html())
}
}
/**