fix(core): update

This commit is contained in:
2021-10-04 13:35:20 +02:00
parent 64b50eeb1c
commit 2a5013fb56
6 changed files with 18516 additions and 2243 deletions

View File

@ -7,11 +7,12 @@ export class SmartMarkdown {
* converts markdown to html
* @param mdString
*/
public markdownToHtml(mdString: string): string {
return plugins.marked(mdString);
public async markdownToHtml(mdString: string): Promise<string> {
const result = await plugins.remark().use(plugins.remarkHtml).process(mdString);
return result.toString();
}
public htmlToMarkdown(htmlString): string {
public htmlToMarkdown(htmlString: string): string {
const turndownInstance = new plugins.turndown({
headingStyle: 'atx',
codeBlockStyle: 'fenced',

View File

@ -1,5 +1,16 @@
import marked = require('marked');
// third party remark
import remark from 'remark';
import remarkHtml from 'remark-html';
export {
remark,
remarkHtml
}
// other third party stuff
import turndown from 'turndown';
// @ts-ignore
import * as turndownPluginGfm from 'turndown-plugin-gfm';
export { marked, turndown, turndownPluginGfm };
export { turndown, turndownPluginGfm };