This is probably a stupid question, but any time I press the tab button, it formats the text like a code block. How do I get it to just indent normally? Like if I’m writing dialogue I want to indent it, but it just formats it like a code block. Thank you!
You don’t. Paragraphs are indicated by separating them with blank lines. Basic formatting syntax - Obsidian Help
If you’re planing to publish or something, you can use CSS to make renderings like Reading View or exports show an indent instead of blank lines. But in the source text itself you just use blank lines.
If you only want to indent for editing purposes, you can indent by up to 3 spaces and it will be ignored in renderings like Reading View.
(Also indentation can be used in lists to indicate sub lists.)
Markdown does not have a specific syntax to indent a paragraph of regular text. The use of tab or spaces in front of a line marks it as code block, as you discovered.
The closest thing to a “indented paragraph” is a quote, marked by a > in front of the line. However, the css used by obsidian gives that quote a specific and distinct appearance (a blue line at the left, sometimes a different background color, etc). Some themes make even stronger visual changes (different font color, etc).
I wrote a css snippet that tries to remove all this, and leave only the indentation. This is the snippet:
/*
Description: Turns blockquotes (>) into simple indented paragraphs.
*/
/* == 1. Live Preview / Editing Mode == */
div.cm-line.HyperMD-quote .cm-blockquote-border {
display: none !important;
}
div.cm-line.HyperMD-quote::before {
display: none !important;
content: none !important;
border: none !important;
background: none !important;
}
div.cm-line.HyperMD-quote {
text-indent: 0 !important;
background: none !important;
border: none !important;
box-shadow: none !important;
padding-inline-start: 0 !important;
}
/* -- STEP 3: Apply our custom indentation per level -- */
div.cm-line.HyperMD-quote-1 {
padding-inline-start: 2.5em !important;
}
div.cm-line.HyperMD-quote-2 {
padding-inline-start: 5em !important;
}
div.cm-line.HyperMD-quote-3 {
padding-inline-start: 7.5em !important;
}
/* == 2. Reading Mode == */
.markdown-reading-view blockquote {
border-left: none; /* Removes the vertical line */
background-color: transparent; /* Removes any background color from the theme */
margin-left: 0; /* Resets default margin */
/* THIS IS THE LINE YOU CAN CHANGE for more/less indent */
padding-left: 2em; /* Sets your desired indentation */
}
An example of markdown using it:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
> Integer interdum tempus tellus, nec dignissim orci luctus et. Nam dignissim risus quis pellentesque tincidunt.
> > Proin congue dui in turpis tincidunt, sit amet facilisis mauris rutrum. Quisque dapibus, augue eu vestibulum feugiat, enim urna imperdiet velit, sed venenatis purus neque id velit.
> Aenean vitae pulvinar sem. Pellentesque porttitor lacus in sapien bibendum mattis. Donec convallis mauris odio, at facilisis nunc convallis eget. Integer egestas molestie lorem eu imperdiet.
Nullam laoreet metus id magna porta, luctus ornare elit auctor. Aliquam vel elit est. Sed sagittis in sem eget ornare. In eleifend a urna non ultrices.
This how it looks in preview mode with the default theme:
Update. By adding this to the css snippet:
div.cm-line:not(.cm-active) .cm-formatting-quote {
display: none !important;
}
you get rid of the extra space visible at the beginning of the first line in each quote (this is caused by the “>” that becomes invisible once the cursor leaves the paragraph).
Also, as you might guess from the name, the block quote syntax is intended for marking block quotes. Using them for other things means you can’t do that anymore, plus undermines Markdown’s system of saying what things are. (Actually block quote conceptually isn’t a bad fit for dialogue, tho I’ve never seen it used that way, so it’s not a good practical choice for publication.)
If you’re going to restyle an element with CSS anyway, you may as well restyle paragraphs instead of restyling another element and using it for paragraphs.
If you want to indent some paragraphs but not others, any way to do that will be at least a little hacky.
