fix(core): update
This commit is contained in:
17
ts/index.ts
17
ts/index.ts
@@ -1,20 +1,17 @@
|
||||
import * as plugins from './smartmarkdown.plugins.js';
|
||||
import { MdParsedResult } from './smartmarkdown.classes.mdparsedresult.js';
|
||||
|
||||
export class SmartMarkdown {
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* converts markdown to html
|
||||
* @param mdString
|
||||
* create a MdParsedResult from markdown
|
||||
* @param mdStringArg
|
||||
*/
|
||||
public async markdownToHtml(mdString: string): Promise<string> {
|
||||
const result = await plugins
|
||||
.remark.remark()
|
||||
.use(plugins.remarkHtml.default)
|
||||
.use(plugins.remarkFrontmatter.default, ['yaml', 'toml'])
|
||||
.process(mdString);
|
||||
return result.toString();
|
||||
}
|
||||
public async getMdParsedResultFromMarkdown(mdStringArg: string): Promise<MdParsedResult> {
|
||||
const result = await MdParsedResult.createFromMarkdownString(mdStringArg);
|
||||
return result;
|
||||
};
|
||||
|
||||
public htmlToMarkdown(htmlString: string): string {
|
||||
const turndownInstance = new plugins.turndown({
|
||||
|
||||
Reference in New Issue
Block a user