Code doesn't maintain indentation when copy-pasted inside the code block

I am not sure if it’s a bug or I messed up a setting.

After updating the obsidian to v0.10.1 I am having an issue whenever I am pasting some code in the code blocks(the one we make via ```)

Say I have the following code:

public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    initView();
    Intent intent = getIntent();
    if (intent != null) {
        if (intent.getIntExtra("FLAG", -1) != 0) {
            finish();
        } else {
            checkSource(intent);
        }
    }
}

If I paste that in the code block inside obsidian it looks like this:

As you can see the code is unindented.

I don’t recall changing any settings after the update so I am really not sure. To make sure it’s not the “theme” I even tried to disable the theme but still had the same issue.

System Info

I am using MANJARO and the version of obsidian is v0.10.1. The theme that I am using is Obsidian Nord

2 Likes

read the release notes. Something did change.

Hey, I did read these but I don’t see any mention of the code blocks or indentations.

You might need to Ctrl+Shift+V to paste as plaintext.

12 Likes

oh Thanks!!

Sorry for posting on an old thread but this is the first link when Googling for this problem.

This problem is caused by the “Auto Convert HTML” feature which can be disabled in the settings. If you paste a lot of code, and don’t care about HTML, you might prefer to do this.

9 Likes