mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
20 lines
429 B
TypeScript
20 lines
429 B
TypeScript
"use strict";
|
|
|
|
import TurndownService from "turndown";
|
|
import turndownPluginGfm from "joplin-turndown-plugin-gfm";
|
|
|
|
let instance: TurndownService | null = null;
|
|
|
|
function toMarkdown(content: string) {
|
|
if (instance === null) {
|
|
instance = new TurndownService({ codeBlockStyle: 'fenced' });
|
|
instance.use(turndownPluginGfm.gfm);
|
|
}
|
|
|
|
return instance.turndown(content);
|
|
}
|
|
|
|
export default {
|
|
toMarkdown
|
|
};
|