Oh sorry ! I tried my best to be understandable but i'm not used to remark, nor gitter, nor english in fact ... :flushed:
All the code is here http://git.ache.one/markdown-viewer/blob/master/app.js
Important part :
unified()
.use(remark)
.use(mermaid)
.use(textInput) // The plugin who deal with the textarea
.use(math)
.use(kbd)
.use(highlight)
.use(html, {allowDangerousHTML: true}) // This is remark-rehype
.use(rehypeKatex)
.use(raw)
.use(rehypeStringify)
.process(data, // [...]
The code source of the plugin : http://git.ache.one/remark-text-input/
I don't think there is a most important part but it's only 64 lines long. The plugin is about creating some interactives stuff from a Markdown document (in a same manner as Markdown)
Maybe, i will check it this nigth and edit this text if i find something revelant. As i say i'm not used to remark.
'html'
nodes from your plugin though, instead opting for embedded HAST. remark-math and remark-kbd do so as well: https://github.com/Rokt33r/remark-math/blob/0a0a0f826ff26ea51776faa1576d5f7ee9d1239a/packages/remark-math/block.js#L181-L194
children
in that case (which is for markdown nodes), but you should be using data.hChildren (for the embedded HAST children)
mdast-util-to-hast
docs for more info! https://github.com/syntax-tree/mdast-util-to-hast#note
Hi @wooorm, I have a question regarding Remark. The mdast-util-to-hast
plugin will create raw
nodes when there is html element in the markdown parse with remark
. As a result hast-util-sanitize
will ignore those raw
nodes and strip the html element, leaving only the text without markup.
I saw that there is a rehype-raw
plugin that rehidrate the raw
, yet it will mean I have to use remark-to-rehype
somehow.
Is there a better way to reprocess an hast
and convert raw
nodes that contains html to hast-html-element?
[^footnote]:
becomes [^footnote]:
$ echo '[^footnote]:' | remark
[^footnote]:
<stdin>: no issues found
--settings footnotes:true
let g:formatdef_remark_markdown = '"remark --quiet --no-color | sed ''s/:/\:/g''"'
footnotes:true
isn't the default?
--settings
documented somewhere?
const markdown = remark()
.use(toc)
.stringify(mdast) // The markdown AST
Good day all. I'm using remark-toc
in my markdown processing like this:
const articleRawHTML = await remark()
.use(highlight)
.use(slug)
.use(headings)
.use(toc)
.use(html)
.process(articleContent.content)
It works great, but I'd like to show the generated TOC somewhere else on my page (for example in an aside). Is there a way to retrieve only the TOC's HTML?. If it is possible I'd appreciate your guidance. Thanks!