mirror of
https://github.com/zadam/trilium.git
synced 2025-11-07 22:05:44 +01:00
19 lines
373 B
JavaScript
19 lines
373 B
JavaScript
|
|
"use strict";
|
||
|
|
|
||
|
|
const TurndownService = require('turndown');
|
||
|
|
const turndownPluginGfm = require('turndown-plugin-gfm');
|
||
|
|
|
||
|
|
let instance = null;
|
||
|
|
|
||
|
|
function toMarkdown(content) {
|
||
|
|
if (instance === null) {
|
||
|
|
instance = new TurndownService();
|
||
|
|
instance.use(turndownPluginGfm.gfm);
|
||
|
|
}
|
||
|
|
|
||
|
|
return instance.turndown(content);
|
||
|
|
}
|
||
|
|
|
||
|
|
module.exports = {
|
||
|
|
toMarkdown
|
||
|
|
};
|