Skip to content

Code formatting is adding a new line #41

@edap

Description

@edap

Hello, first of all, thanks for developing this addon, it is really useful to me.

I have a problem when inserting code blocks. If I copy a text formatted for markdown from Visual Studio Code to Anki (with type katex and markdown basic), the indentation is stripped off.

If I copy the text from Visual Studio Code to another editor, like Gedit, and then to Anki, the indentation is correct, but a new line is inserted after every line. So this markdown text:

```rust
use std::thread;
use std::time::Duration;

fn main() {
    let handle = thread::spawn(|| {
        for i in 1..10 {
            println!("hi number {i} from the spawned thread!");
            thread::sleep(Duration::from_millis(1));
        }
    });

    handle.join().unwrap();

    for i in 1..5 {
        println!("hi number {i} from the main thread!");
        thread::sleep(Duration::from_millis(1));
    }
}



Becomes:



use std::thread;

use std::time::Duration;

fn main() {

thread::spawn(|| {

    for i in 1..10 {

        println!("hi number {i} from the spawned thread!");

        thread::sleep(Duration::from_millis(1));

    }

});


for i in 1..5 {

    println!("hi number {i} from the main thread!");

    thread::sleep(Duration::from_millis(1));

}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions