mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-15 15:44:03 +08:00
e711290d8b
Had to do some manual fixing of the app.js file due to misplaced comments
29 lines
615 B
JavaScript
29 lines
615 B
JavaScript
import MarkdownIt from 'markdown-it';
|
|
import mdTasksLists from 'markdown-it-task-lists';
|
|
|
|
export class Markdown {
|
|
|
|
constructor() {
|
|
this.renderer = new MarkdownIt({html: true});
|
|
this.renderer.use(mdTasksLists, {label: true});
|
|
}
|
|
|
|
/**
|
|
* Get the front-end render used to convert markdown to HTML.
|
|
* @returns {MarkdownIt}
|
|
*/
|
|
getRenderer() {
|
|
return this.renderer;
|
|
}
|
|
|
|
/**
|
|
* Convert the given Markdown to HTML.
|
|
* @param {String} markdown
|
|
* @returns {String}
|
|
*/
|
|
render(markdown) {
|
|
return this.renderer.render(markdown);
|
|
}
|
|
|
|
}
|