mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
Comparing MarkdownDocuments when one has been appended to #671
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jphorv-bdo on GitHub (Apr 29, 2024).
I have a problem for which I don't see an obvious solution. I have a markdown
stringthat is continuously appended to. After each append it is parsed to aMarkdownDocument. I want to determine what blocks are different between the previousMarkdownDocumentand the latest one.My naive approach was to iterate over each document's top-level
Blocks and compare theirSpanproperties, something like:But that doesn't work. One scenario where I found it doesn't (and surely there are more) is when the document ends in the middle of a fenced code block, the block's
Spanproperty doesn't encompass the remainder of the markdown string, and it isn't until the fenced block's delimiter arrives that thatSpanaccurately reflects the whole length of the fenced block. I assume this is expected behavior.My question is, for 2 non-null
Blockobjects, what can I compare on them to determine equality?