Ability to customize code block indentation

It would be awesome to enable custom indentation for code blocks. It looks like currently this defaults to 4 spaces, whereas I find 2 spaces much more readable, given the narrow nature of the cards.

I have noticed that the spacing also get styled even more “wide” in the view mode, is this on purpose?
For example here is an edit-mode indent
image
Which turns to this
image

I purposefully excluded the padding of the code block element in the view-mode to compare the indentation itself. As you can see it nearly doubles :thinking: Is this a bug?

Hi @fuzzy.beach,

Custom code block indentation has already been implemented. Have you tried changing your ident type in App Preferences > Custom Behavior > Indent Type? You can change this from 4 spaces to 2 spaces.

Which app / os are you using? Could you share the raw markdown below? I’m unable to replicate your screenshots for me they aren’t styled even more wide.

1 Like

I am on M1 Mac with Ventura. Ah, that’s great, The two spaces setting works correctly. I previously had it set to Tabs (I guess that’s the default?). I think the behaviour may be due to that setting?

Sure, this is the markdown

```go
func main() {
  fmt.Println("One indent")
    fmt.Println("Two indents")

	for i := 0; i < 10; i++ {
		defer fmt.Println("Previous indent setting of `tab`")
	}

	fmt.Println("done")
}

...

The really odd thing is, that the for loop was indented with the setting set to “Tabs”, before I made the change. As you can see, A double indent of 2 spaces renders narrower than the previous setting, even though in markdown they look the same.

image

image

Hi @fuzzy.beach,

That makes sense thanks for the further info. We will look into why the rendering is a bit off with tabs.