Skip to content

How to add directives to an AST? #147

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

You must be logged in to vote

Welcome @lukasb!

This shows an example of a leaf directive as the child of a paragraph

The readme has many examples, could you clarify which you are looking at?

However, MdastParagraph.children is of type PhrasingContent[]. I could add LeafDirective to PhrasingContentMap, but that feels wrong - I would expect that mdast-util-directive would do that if it was necessary.

Are you asking about the typescript type?
That is registered by the plugin you don’t have to add anything.

If you are looking for how an AST should look.
I'd recommend using https://remark.js.org/
An enter what you want the markdown to look like and use that AST as a reference.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lukasb
Comment options

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