Kind of a niche request but here goes. While we’re waiting for the WYSIWYG editor, I’m using CSS tweaks to hide markdown in the editor except on the .CodeMirror-activeline line. I know others do the same from threads such as this.
The only inconvenience with this method is that the .CodeMirror-activeline class disappears on text selection. This makes the text selection action itself more difficult because the line underneath the cursor jerks around.
Please see video below. (Not my video, but from the aforementioned thread.)
Proposed solution
Persist the .CodeMirror-activeline class on editor text selection. Or add a different class. Simply anything that could be targeted with CSS, really.
It’s an interesting approach to make the markdown tags transparent rather than hide them, but it has its own issue of leaving a lot of awkward gaps in the text and misaligned headings, even though it does enable easy text selection.
Thank you for the idea, I’ll keep it in mind as I play around with the CSS. But I would still rather see .CodeMirror-activeline persist on selected text. Such a small change but such a big difference for CSS hackability.
I don’t think WYSIWYG mode would make the request for a robust active line selector obsolete. Simulating WYSIWYG was how I wanted to utilize it, but it has other utility, including styling the future WYSIWYG mode itself. Clearly there is value in an active line class, or there would not be one at all. I just think the active line class should not disappear when text is selected in the active line.
Anyway, I just fixed it myself.
Unfortunately I can’t share instructions because I’m unsure modifying Obsidian at the layer this change needed to be made is within the forum rules. But if a developer wants to PM me I’ll be glad to tell them what to change.
This can actually be done fairly straightforwardly with a plugin. The .CodeMirror-activeline class is set by CodeMirror’s active-line addon. There is a configuration option in CodeMirror’s API that preserves this class when the text selection is contained in the active line, but the obsidian developers have not enabled it. Fortunately, Obsidian’s API exposes the embedded CodeMirror editor, so we can enable this feature manually by writing an obsidian plugin with the following code:
This will become deprecated in the future, but it should continue to work until WYSIWYG is implemented, at which point this plugin is no longer needed.