Mark decorations in the example have the following description:
- Mark decorations are the most common. These add some attributes or wrapping DOM element to pieces of content. Syntax highlighting, for example, is done with mark decorations.
However, reading mark decoration description itself
Create a mark decoration, which influences the styling of the content in its range. Nested mark decorations will cause nested DOM elements to be created. Nesting order is determined by precedence of the facet, with the higher-precedence decorations creating the inner DOM nodes. Such elements are split on line boundaries and on the boundaries of lower-precedence decorations.
seems almost like you can’t reuse existing DOM nodes.
I’m trying to mark nodes that are currently selected with a new class, using syntaxTree iteration, but it currently adds a lot of spans and doesn’t add classes to existing spans. What should be the correct behaviour? If it can reuse spans, how can I enable that?
I want to see if the current markdown element is selected and show it’s control tokens (**), or hide them if not, creating a sort of WYSIWYG editor, kind of like HyperMD.