Turns out, it's not actually a re-rendering issue, but rather a problem with how I am storing the string.
In the current version, I store the string in the ViewModel without any of the Markdown syntax. Then my code tries to re-parse the string. Obviously, the parsing does not work, because there is no Markdown in the string that can be parsed...
The interesting thing is, that initially when I load the MD file, all the syntax is parsed correctly, but as soon as I type a character, the whole string gets replaced with a version that has all the syntax removed - this is what I call the collapsed version.
I must store the expanded version (the one with all the Markdown syntax), because otherwise the styling is completely lost.
But I also need a string without the syntax, as this is the one that should be displayed by default in the 'Live Preview' mode.
**So, this is my plan...**
I need to store two different strings:
- Collapsed version (what user sees in the editor): `"Display & Remove Syntax"`
- Expanded version (with syntax): `"# Display & Remove Syntax"`
When I want to render the syntax (e.g. if user clicks in formatted text), I should use the expanded version.
But I only want to show the syntax for that particular range, not for the entire string...
View quoted note →