swiftlang / swift-markdown

A Swift package for parsing, building, editing, and analyzing Markdown documents.
https://swiftpackageindex.com/swiftlang/swift-markdown/documentation/markdown
Apache License 2.0
2.79k stars 191 forks source link

Ability to make custom Markups #161

Open amyworrall opened 10 months ago

amyworrall commented 10 months ago

It seems that one cannot make custom things conforming to Markup, because things like AbsoluteRawMarkup and _MarkupData's init method are not public. I'd like to be able to make these. Current use case: I'd like to make a Mention type; this should be similar to Text but with an extra piece of data. I'd like to be able to insert it into the tree, but without access to the above things, it gets turned into a regular Text markup element as soon as I add it as a child of something.