SwiftDocOrg / CommonMark

Create, parse, and render Markdown text according to the CommonMark specification
MIT License
179 stars 10 forks source link

Enhancement: Also provide a replace method on a node with children #15

Closed Lukas-Stuehrk closed 3 years ago

Lukas-Stuehrk commented 4 years ago

Currently, there's no dedicated method to replace a node with another node.

One could already express a replacement with a combination of insert and remove, but I think it makes sense to also provide a wrapper around cmark's cmark_node_replace(). The same like we do for all the other operations on nodes.

I can provide a pull request once #11 is merged.

mattt commented 4 years ago

@Lukas-Stuehrk That sounds great! Given that there's already a cmark function that does this, it should be a straightforward addition (the hardest part may be getting the right argument order 😝).