You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having a defined type member would help discriminating them when iterating the markdown tree.
It also seems to be an issue for the https://www.npmjs.com/package/@types/marked packages, where the Def interface does't have a type member, and thus it is not possible to discriminate node types in typescript (I guess it could be possible to add a type member in the interface, but it would be troublesome if this project later chose a different string).
Describe the solution you'd like
Add a type member to all nodes of the markdown tree.
Activity
UziTech commentedon Apr 8, 2021
If you would like to create a PR to add the type that would be much appreciated.
You should just need to add a
typeproperty to thedeftokenizer's return objectmarked/src/Tokenizer.js
Lines 344 to 356 in d0f9ffd
sapristi commentedon Apr 9, 2021
Ok I will do one. What about the case where the
spacenode doesn't define atypemember ?Edit: It seems the case where space doesn't define
typemember is rejectedby the lexer, so I guess it can stay as it is.marked/src/Lexer.js
Line 132 in d0f9ffd