Skip to content

How to extend mdast? #83

Answered by wooorm
eliyap asked this question in Q&A
Aug 20, 2021 · 1 comments · 18 replies
Discussion options

You must be logged in to vote

Hey!

One part of how to extend mdast is conceptual, and you already found it. Your mark syntax is Phrasing content.
The other part is TypeScript-specific. You can define a new Mark node that extends from Parent, with a type: 'mark', and children: PhrasingContent[], and then register the mark node by adding it to StaticPhrasingContentMap:

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/fe99cda97743cac0940e4960e3a904b655277362/types/mdast/index.d.ts#L76-L101

Replies: 1 comment 18 replies

Comment options

You must be logged in to vote
18 replies
@ChristianMurphy

This comment was marked as off-topic.

@shlroland

This comment was marked as off-topic.

@ChristianMurphy

This comment was marked as off-topic.

@shlroland
Comment options

@ChristianMurphy
Comment options

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