(options?)
| 3 | var turndownPluginGfm = require("@joplin/turndown-plugin-gfm") |
| 4 | |
| 5 | export default function Turndown(options?) { |
| 6 | const gfm = turndownPluginGfm.gfm |
| 7 | const tables = turndownPluginGfm.tables |
| 8 | const strikethrough = turndownPluginGfm.strikethrough |
| 9 | const turndownService = new TurndownService({ |
| 10 | headingStyle: "atx", |
| 11 | codeBlockStyle: "fenced" |
| 12 | }) |
| 13 | |
| 14 | turndownService.use(gfm) |
| 15 | turndownService.use(tables, strikethrough) |
| 16 | |
| 17 | // turndownService.keep(["h1", "h2"]) |
| 18 | turndownService.remove(["script", "style"]) |
| 19 | |
| 20 | const addRules = options?.addRules |
| 21 | for (let key in addRules) { |
| 22 | const rule = addRules[key] |
| 23 | if (rule) { |
| 24 | turndownService.addRule(key, rule) |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | return turndownService |
| 29 | } |
no outgoing calls
no test coverage detected