Extra spaces in edit & view mode

Use case or problem

I want to introduce some "nbsp;" to add some extra spaces. When I go to view mode this is transformed into spaces. but not in edit & view mode.

Proposed solution

I guess as for some other feature as [[link]] it has be added to be taken in consideration.

It would allow doing indentations in titles too…

Current workaround (optional)

Related feature requests (optional)

I think you meant one of those “view modes” to be something else? Also, none of the views are called “view mode” — there’s Reading view, and Editing view. Editing view can be in Source Mode or Live Preview. (And I just realized I’ve been calling Reading view “Reading Mode” for months.)

I’m not fully sure what you’re trying to do with the spaces, but depending on what it is you might be better off setting a custom style to add some padding or margin instead.

translation of french menu…
3 modes: direct view, edit direct view, and edit (raw MD view)
e.g: 2 first are making appear an underline wikilink text. 3rd one: [[text]]
same: 2 first modes would make appear a space. 3rd one: nbsp;

I see, it sounds like those direct view = reading view, edit direct view = live preview, edit (raw MD view) = source mode.

What is the purpose of the extra spaces?

Have several following spaces when needed.

That doesn’t tell me what the spaces are for. Why do you need several following spaces? Your deleted post explained more. It sounds like you use them to align text. That’s not what non-breaking spaces are for. — that’s what margin, padding and other CSS things are for. Using a CSS snippet would also free you from typing extra spaces every time.

If you lack the patience to work with Obsidian’s difficult CSS, you can put spans around your non-breaking spaces to make Obsidian recognize them as HTML: <span>&nbsp;&nbsp;</span>.

I was searching info about CSS in obsidian, when I saw your notification. I studied html yesterday and now CSS.
span could be very useful in this situation.
but yes a more general approach appears to be an answer in more situations
what I did the first day I used obsidian are shortcuts for every common transformation in MD. I use 2 plugins, but ultimately I want to do a plugin with some menus grouping different transformations. I began to learn JS…

Also, the HTML and CSS of Obsidian’s default theme will be changing, in part to make working with the CSS easier. The new default theme is in the current Insider build.

1 Like

I did my own theme but I used a css snipet to make some tests
I did this to add a padding to h1 and a color when hover (just to see better the effect)
I have one line without :hover so blue by default, but I don’t see what’s for

h1:hover, .markdown-rendered h1:hover, .HyperMD-header-1:hover, .HyperMD-list-line .cm-header-1 { color: rgb(8, 0, 255); padding-left: 50px; }

/*
.HyperMD-header-1 → edit&view /raw
.markdown-rendered h1 → direct view
h1 is needed to not have the padding by default in direct view
.HyperMD-list-line .cm-header-1 what for ?
*/

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.