Can I cancel the 1-space indentation before code blocks?

Things I have tried

What I’m trying to do

I noticed that when I typing ``` it will indent 1 space which makes the code block is not aligned to the text. I don’t like it and I want to cancel this 1-space indentation. Is there any way to do this?

Snipaste_2023-02-05_12-51-57

It can most likely be done using CSS, but which theme are you using, if any?

It looks like the CSS selector .markdown-source-view.mod-cm6 .cm-line.HyperMD-codeblock has padding-left (in my case it’s 16 pixels—I don’t know if that’s from the theme or Obsidian). A CSS snippet like this should remove the padding:

.markdown-source-view.mod-cm6 .cm-line.HyperMD-codeblock {
  padding-left: 0;
}

If you want to deal with situations like code blocks inside of callouts, you’d need to add to the selector.

1 Like

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