How can i keep white space formatting in preview?

Things I have tried

What I’m trying to do

In markdown i can insert spaces or tabs for horizontal line formatting.
But the formatting is lost in the Preview pane. I also have enabled the ‘Use tabs’ option.

v.0.12.15, Linux

1 Like

If you’re just trying to create a horizontal line, then you can just add --- into your note and it gets rendered as a horizontal rule that is formatted based on the theme for your vault. It sounds like you may be trying to do something else, though, so the rest of my response is geared toward that.

Markdown from Edit mode gets rendered into HTML in Preview mode. HTML does not keep white space unless you go out of your way to keep it.

Depending on what you’re doing, using a code block might be a good solution. In my vault, I find that inserting a certain number spaces before a word automatically changes the format to a code block, but I’m not sure whether that is intended behavior.

You could also add your own custom styling to your notes by either editing the CSS for your theme or adding your own CSS snippet. For example, I entered this into a note:

<div class="my-test">
Text
</div>

Then I entered this into my theme’s CSS file:

.my-test {
	text-align: center;
}

The result is that “Text” is centered in Preview mode. Of course, you would replace the style with the formatting you are trying to achieve.

code block is usefull since it retains tabs and spaces but is usually red colored.
Unfortunately trying to play with CSS i hit on a small obstacle.
I cant run Ctri+Shift+I cause i have Ctrl+Shift is mapped to change keyboard layout.

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