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

Function useEditMarkdown

utils/editMarkdownHook.ts:6–27  ·  view source on GitHub ↗
(option?)

Source from the content-addressed store, hash-verified

4import Turndown from "~utils/turndown"
5
6export function useEditMarkdown(option?) {
7 const turndownService = Turndown(option)
8
9 const [post, setPost] = useStorage({
10 key: "md-post",
11 instance: new Storage({
12 area: "local"
13 })
14 })
15
16 const handleSetPost = (selectorDom, articleTitle) => {
17 const content = turndownService.turndown(selectorDom)
18 const post = {
19 content: content,
20 title: articleTitle
21 }
22 setPost(JSON.stringify(post))
23 window.open("https://md.code-box.fun", "_blank")
24 }
25
26 return [post, handleSetPost]
27}

Callers 15

CustomDomSelectorFunction · 0.90
PlasmoOverlayFunction · 0.90
PlasmoOverlayFunction · 0.90
PlasmoOverlayFunction · 0.90
PlasmoOverlayFunction · 0.90
PlasmoOverlayFunction · 0.90
PlasmoOverlayFunction · 0.90
PlasmoOverlayFunction · 0.90
PlasmoOverlayFunction · 0.90
PlasmoOverlayFunction · 0.90
PlasmoOverlayFunction · 0.90
PlasmoOverlayFunction · 0.90

Calls 1

TurndownFunction · 0.85

Tested by

no test coverage detected