Properly hiding BlockIDs from the view layer

Hi, I’m working on a plugin that publishes Obsidian notes as web pages. One of the requirements is to make blocks linkable, so on publishing, I assign an ID to each block using ^. But since these IDs are visible in UI, notes become unbearably noisy.

My first attempt to clean up views was via CSS and display: none, but it’s a hack that messes up keyboard navigation. Eg, if I hit A in Vim mode (jump to the end of the line + go into insert mode) and start removing characters, it removes hidden characters of blockid, not characters that are visible in the view, because Obsidian operates on what’s in the state, not on what’s in the view.

Then I tried to handle it via CodeMirror extension, but the only thing I could do was to hide blockid nodes from UI, which resulted in the same issue as with display: none - even though the node is not in the DOM, the editor still operates on the internal state which contains blockids.

What would be my best bet in this case?