mirror of https://github.com/requarks/wiki
parent
0b93544677
commit
09d1f580d9
@ -1,16 +1,30 @@
|
|||||||
require('../core/worker')
|
require('../core/worker')
|
||||||
|
|
||||||
|
const _ = require('lodash')
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
WIKI.models = require('../core/db').init()
|
WIKI.models = require('../core/db').init()
|
||||||
|
|
||||||
module.exports = async (job) => {
|
module.exports = async (job) => {
|
||||||
WIKI.logger.info(`Rendering page ${job.data.path}...`)
|
WIKI.logger.info(`Rendering page ${job.data.page.path}...`)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
WIKI.logger.info(`Rendering page ${job.data.path}: [ COMPLETED ]`)
|
let output = job.data.page.content
|
||||||
|
for (let core of job.data.pipeline) {
|
||||||
|
const renderer = require(`../modules/rendering/${_.kebabCase(core.key)}/renderer.js`)
|
||||||
|
output = await renderer.render.call({
|
||||||
|
config: core.config,
|
||||||
|
children: core.children,
|
||||||
|
page: job.data.page,
|
||||||
|
input: output
|
||||||
|
})
|
||||||
|
}
|
||||||
|
console.info(output)
|
||||||
|
|
||||||
|
WIKI.logger.info(`Rendering page ${job.data.page.path}: [ COMPLETED ]`)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
WIKI.logger.error(`Rendering page ${job.data.path}: [ FAILED ]`)
|
WIKI.logger.error(`Rendering page ${job.data.page.path}: [ FAILED ]`)
|
||||||
WIKI.logger.error(err.message)
|
WIKI.logger.error(err.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
key: htmlSecurity
|
|
||||||
title: Security
|
|
||||||
description: Filter and strips potentially dangerous content
|
|
||||||
author: requarks.io
|
|
||||||
icon: whatshot
|
|
||||||
enabledDefault: true
|
|
||||||
dependsOn: htmlCore
|
|
||||||
props: {}
|
|
@ -1,31 +0,0 @@
|
|||||||
key: markdownCore
|
|
||||||
title: Core
|
|
||||||
description: Basic Markdown Parser
|
|
||||||
author: requarks.io
|
|
||||||
input: markdown
|
|
||||||
output: html
|
|
||||||
icon: crop_free
|
|
||||||
props:
|
|
||||||
linkify:
|
|
||||||
type: Boolean
|
|
||||||
default: true
|
|
||||||
title: Automatically convert links
|
|
||||||
hint: Links will automatically be converted to clickable links.
|
|
||||||
linebreaks:
|
|
||||||
type: Boolean
|
|
||||||
default: true
|
|
||||||
title: Automatically convert line breaks
|
|
||||||
hint: Add linebreaks within paragraphs.
|
|
||||||
highlightCode:
|
|
||||||
type: Boolean
|
|
||||||
default: true
|
|
||||||
title: Highlight code blocks
|
|
||||||
hint: Add syntax coloring to code blocks.
|
|
||||||
codeTheme:
|
|
||||||
type: String
|
|
||||||
default: light
|
|
||||||
title: Code Color Theme
|
|
||||||
hint: Color theme for code blocks
|
|
||||||
enum:
|
|
||||||
- light
|
|
||||||
- dark
|
|
@ -1 +0,0 @@
|
|||||||
module.exports = {}
|
|
@ -1 +0,0 @@
|
|||||||
module.exports = {}
|
|
@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
async render() {
|
||||||
|
return this.input
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
key: htmlSecurity
|
||||||
|
title: Security
|
||||||
|
description: Filter and strips potentially dangerous content
|
||||||
|
author: requarks.io
|
||||||
|
icon: whatshot
|
||||||
|
enabledDefault: true
|
||||||
|
dependsOn: htmlCore
|
||||||
|
props:
|
||||||
|
stripJS:
|
||||||
|
type: Boolean
|
||||||
|
title: Strip Javascript
|
||||||
|
default: false
|
||||||
|
hint: Javascript code within code blocks won't be affected
|
||||||
|
filterBadWords:
|
||||||
|
type: Boolean
|
||||||
|
title: Filter Bad Words
|
||||||
|
default: false
|
||||||
|
hint: Replace bad words with asterisks
|
@ -0,0 +1,51 @@
|
|||||||
|
key: markdownCore
|
||||||
|
title: Core
|
||||||
|
description: Basic Markdown Parser
|
||||||
|
author: requarks.io
|
||||||
|
input: markdown
|
||||||
|
output: html
|
||||||
|
icon: crop_free
|
||||||
|
props:
|
||||||
|
allowHTML:
|
||||||
|
type: Boolean
|
||||||
|
default: true
|
||||||
|
title: Allow HTML
|
||||||
|
hint: Enable HTML tags in content
|
||||||
|
linkify:
|
||||||
|
type: Boolean
|
||||||
|
default: true
|
||||||
|
title: Automatically convert links
|
||||||
|
hint: Links will automatically be converted to clickable links.
|
||||||
|
linebreaks:
|
||||||
|
type: Boolean
|
||||||
|
default: true
|
||||||
|
title: Automatically convert line breaks
|
||||||
|
hint: Add linebreaks within paragraphs.
|
||||||
|
typographer:
|
||||||
|
type: Boolean
|
||||||
|
default: false
|
||||||
|
title: Typographer
|
||||||
|
hint: Enable some language-neutral replacement + quotes beautification
|
||||||
|
quotes:
|
||||||
|
type: String
|
||||||
|
default: English
|
||||||
|
title: Quotes style
|
||||||
|
hint: When typographer is enabled. Double + single quotes replacement pairs. e.g. «»„“ for Russian, „“‚‘ for German, etc.
|
||||||
|
enum:
|
||||||
|
- Chinese
|
||||||
|
- English
|
||||||
|
- French
|
||||||
|
- German
|
||||||
|
- Greek
|
||||||
|
- Japanese
|
||||||
|
- Hungarian
|
||||||
|
- Polish
|
||||||
|
- Portuguese
|
||||||
|
- Russian
|
||||||
|
- Spanish
|
||||||
|
- Swedish
|
||||||
|
highlightCode:
|
||||||
|
type: Boolean
|
||||||
|
default: true
|
||||||
|
title: Highlight code blocks
|
||||||
|
hint: Add syntax coloring to code blocks.
|
Loading…
Reference in new issue