Skip to content

How to parse/convert markdown to hast to render/display needed HTML? #112

Answered by ChristianMurphy
reypm asked this question in Q&A
Discussion options

You must be logged in to vote

@reypm with a minimal reproducible example, aim to remove as many unrelated pieces as possible.
There are a lot of random plugins which are unrelated to your question on directives which make it harder to interpret and debug.

Back on your question of how to handle a notice.
Focus on how you want the mdast directive to translate to hast, using the data attributes in mdast https://github.com/syntax-tree/mdast-util-to-hast#fields-on-nodes.

import type { VFile } from "vfile";
import type { Blockquote, ListItem } from "mdast";
import type { Element } from "hast";
import type { ContainerDirective } from "mdast-util-directive";
import type { FootnoteDefinition } from "mdast-util-gfm-footnote";
i…

Replies: 2 comments 22 replies

Comment options

You must be logged in to vote
5 replies
@reypm
Comment options

@wooorm
Comment options

@reypm
Comment options

@wooorm
Comment options

@wooorm
Comment options

Comment options

You must be logged in to vote
17 replies
@wooorm
Comment options

@reypm
Comment options

@reypm
Comment options

@ChristianMurphy
Comment options

Answer selected by reypm
@reypm
Comment options

@reypm
Comment options

@ChristianMurphy
Comment options

@reypm
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants