Until the WYSWYG editor comes out, it seems we will have to live with URLs in the editor view, but some URLs are very long. For instance, here is the URL for a Chinese movie I recently needed to reference in a document:
Having this URL in my editor really interrupts the flow when I’m trying to read what I wrote. Without having to use a URL shortener of some kind, is there some way to use CSS that could hide this from view in the editor?
Ideally it would look something like this [I Am Not Madame Bovary](wikipedia.org) or [I Am Not Madame Bovary](🔗)
This is possible, I think, but I question the utility. If you need to modify the url for whatever reason (e.g. there’s extra characters on the end or something) how would you edit it?
When your cursor is on the active line, you’ll see the full URL (so you can edit it) and if it’s not the active line, it’s hidden with a single character (in this case 🔗) shown in its stead.
(Thanks to @Silver for exposing the active line with a CSS class )
@death.au , can you work the same magic to provide a way to hide the # symbol in headings? The change in font size is enough for me to know it’s a heading, and I use a lot of headings, and I don’t like seeing hundreds of # in my editor. Waiting with bated breath…
No problem and many thanks, @death.au! I tried combining your two solutions to achieve two other looks but my css isn’t up to the task, apparently. If you are so inclined and have the time, I would love to see solutions for these (no obligation, obviously):
Remove all # symbols from headings but also add a single § to all headers - just one, regardless of heading level.
Remove all # symbols from headings but also add a single § to first-level headings only–other headings get nothing.
I’ll also add that if you’re looking to do this in the editor, the selectors will be .cm-header-1::before for the H1 or .cm-header::before for all headers.
Without looking too deeply into it, I think it’s probably because a heading with a link gets split up into multiple spans with formatting, etc.
You might try adding :first-child to the selector to see if that helps.
The trick is .cm-formatting-header+.cm-header-1 so it only targets the .cm-header-1 span that comes directly after the .cm-formatting-header span. Since headers (usually) only have their formatting symbol at the start, this should be fine.
… It’s possible I spend too much time working on things that really don’t matter. Especially since Obsidian’s default theme seems to not like links in Setex-style headers:
Thank you so much @death.au I really appreciate it, it works perfectly. I get you, I don’t use “Setex-style headers” but still thanks for including code for it!
I’ll update the code here if anyone else is interested in the full code for all headers