How to add directives to an AST? #147
-
This shows an example of a leaf directive as the child of a paragraph: https://github.com/syntax-tree/mdast-util-directive/blob/main/readme.md 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. What is the correct way to achieve the AST shown in the linked example? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Welcome @lukasb!
The readme has many examples, could you clarify which you are looking at?
Are you asking about the typescript type? If you are looking for how an AST should look. |
Beta Was this translation helpful? Give feedback.
Welcome @lukasb!
The readme has many examples, could you clarify which you are looking at?
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.