MCPcopy
hub / github.com/027xiguapi/code-box / Turndown

Function Turndown

utils/turndown.ts:5–29  ·  view source on GitHub ↗
(options?)

Source from the content-addressed store, hash-verified

3var turndownPluginGfm = require("@joplin/turndown-plugin-gfm")
4
5export 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}

Callers 15

useParseMarkdownFunction · 0.85
useEditMarkdownFunction · 0.85
zhihu.tsxFile · 0.85
oschina.tsxFile · 0.85
pianshen.tsxFile · 0.85
medium.tsxFile · 0.85
luogu.tsxFile · 0.85
cnblogs.tsxFile · 0.85
paywallbuster.tsxFile · 0.85
51cto.tsxFile · 0.85
baidu.tsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected