-
Hi All! I wanted to implement Pandoc's ==highlight== syntax, and since the existing GFM strikethrough is very similar, I thought I would start there. However, I noticed that the type annotations rely on a pre-existing "Delete" extension. What is the correct way to extend PhrasingContent to include, say, a new "Mark" type (to correspond to the html tag)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 18 replies
-
Hey! One part of how to extend mdast is conceptual, and you already found it. Your mark syntax is Phrasing content. |
Beta Was this translation helpful? Give feedback.
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 fromParent
, with atype: 'mark'
, andchildren: PhrasingContent[]
, and then register the mark node by adding it toStaticPhrasingContentMap
:https://github.com/DefinitelyTyped/DefinitelyTyped/blob/fe99cda97743cac0940e4960e3a904b655277362/types/mdast/index.d.ts#L76-L101