1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

MD Editor: Finished conversion to Typescript

This commit is contained in:
Dan Brown
2025-07-20 15:05:19 +01:00
parent 7bbf591a7f
commit 61adc735c8
9 changed files with 188 additions and 138 deletions

View File

@@ -0,0 +1,27 @@
import MarkdownIt from 'markdown-it';
// @ts-ignore
import mdTasksLists from 'markdown-it-task-lists';
export class Markdown {
protected renderer: MarkdownIt;
constructor() {
this.renderer = new MarkdownIt({html: true});
this.renderer.use(mdTasksLists, {label: true});
}
/**
* Get the front-end render used to convert Markdown to HTML.
*/
getRenderer(): MarkdownIt {
return this.renderer;
}
/**
* Convert the given Markdown to HTML.
*/
render(markdown: string): string {
return this.renderer.render(markdown);
}
}