-
Notifications
You must be signed in to change notification settings - Fork 26
Raw blocks drifting right #136
Comments
Testing it further, there is also this weird thing: A code block:
```rust
if b {
let x = 2;
}
``` Formats to A code block: ```rust
if b {
let x = 2;
}
``` |
I just fixed this |
I agree since for this example we would need the hack to be in code blocks and list enum and .... |
I discovered a similar issue: text[
J'ai fait un snippet neovim qui crée des banners ! ```
//////////////////////
// This is a banner //
//////////////////////
```] This is a combination of a few problems. First, the opening of the backticks gets shifted to the line above; secondly, the closing Thank you for your time spent on this project! It makes typst even more awesome. Have a nice day =) |
Thank you for your kind words <3 |
I think disabling raw text formatting until this is fixed could be a good idea as it messes up real bad any raw block (if saving regularly), i know this can be done manually but as it is a known issue for many |
Not against reviewing someone doing that, I'm less and less motivated to work on this to be honest |
How do you turn off raw text formatting? |
I don't think you can unfortunately, maybe take a look at typstyles https://github.com/Enter-tainer/typstyle/ |
[x] I have tested with the master version of typstfmt and not just typst-lsp
Describe the bug
So, uh, sorry to bring this up again, but:
To Reproduce
Run
typstfmt
repetitively on the file, and watch the code block drift further and further right... 😢Ideas to fix ?
I looked at the code, and I think this function does not do things correctly:
In this case, we enter the third branch, and call
ctx.push_raw_indent(s, &mut res);
BUT: herenode.kind()
is not, as one might expect,Raw
(which would allow filtering it somehow), butMarkup
(which internally contains aRaw
) !!Overall, I think simply adding an offset as
push_raw_indent
does is not the right thing to do here. I don't really know how to fix that.REMARK: To motivate against using a hack (like "look inside the markup block, and if it contains a
Raw
don't add indentation!"), let me use the following example:Note how the
Raw
element is now nested twice: it goesCodeBlock
->Markup
->Raw
The text was updated successfully, but these errors were encountered: