Indenting text after headings

Hello guys,

I am currently moving from OneNote to Obsidian and I am used to indent after headings like the example below. Is it possible to do this in Obsidian?

What I expect:
Exemplo

3 Likes

I believe this will have to be implemented with custom css. I don’t know of any theme that behaves like this, but maybe you could tweak that yourself.

1 Like

As far as I know, you cannot do this in plain markdown, but it is possible to make a CSS theme, with text-indent. I’ll make one for you, when I have the time. It won’t be too complicated.

Wow. Quite the coincidence that we came with the same issue on the same day! I look forward to the CSS magic!

1 Like

I ended up messing around with CSS and made this:

You just need to add the following to your obsidian.css, changing the h# and indent size

.markdown-preview-view h3 
{
    text-indent: 1em;
}

The problem, of course, is that the following text isn’t indented in preview mode. I suspect that it isn’t possible to change…

Yeah, that’s quite hard to do. I don’t know of any way to select everything after a certain element in CSS.

Hmm, with the way the html is structured in both edit and preview mode, I’m not sure this is possible. Each formatted section, whether it’s a heading or a paragraph, is wrapped in a <div> and that wrapping element has no classes that identify what’s inside of it.

In short, there’s no way to know whether a paragraph section comes after a particular heading section. The only workaround I can think of is writing a lot of custom html into the markdown file.

The OP is more than welcome to make a feature request for this :grinning:

1 Like

Yeah, seems like something that is beyond the reasonable (or even technical) possibilities of Obsidian. It was a useful experiment for me though - I’ll use the preview outline in my sidebar as a sort of table of contents for my various topic MOCs.

Same here. I’m using more and more headings because I’m finding the outline so useful.

To be clear, what I meant by this was an Index Page that uses indented and styled headings for organizing my MOCs. Each one is a link to the MOC index page (which I’m currently defining and then will populate), whereas the Outline Pane only brings you to that heading within the file. I have this Preview in the sidebar and linked to the main editor window, so when I open the sidebar and click, it brings me to that MOC.

I suppose you could do the same with bullets instead of headings, but I like the styling options that headings afford. I assume that the styling wont be desirable in general, so perhaps I’ll just keep this theme for when I’m doing heavy Indexing work.

Apologies if you already meant something similar.

How it looks in the Outline Pane:

1 Like

Thank vou very much, guys! I think I can work with outline to improve readability of my notes.

Obs: I have tried solutions in this post, but it did not work either

https://stackoverflow.com/questions/46690572/indent-content-based-on-headings