Open haenoe opened 9 months ago
Hey there :)
I'm not sure I fully understand the bug yet
Your example isn't valid typst code, which is the main source of my confusion, this would be valid for instance:
#cite[
// Newline
= Level 1
== Level 2
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
]
You are absolutely right!
I encountered the problem when citing from a bibliography #cite(<BibKey>
(but I forgot the closing brace).
After I saved my whole document got messed up - that is when I thought that there could be a better (more ergonomic) solution to such cases.
The idea was that the formatter should maybe skip such elements (or do some sort of error recovery) or straight up refuse to format such a malformed file (how rustfmt does it e.g.).
Now I don't know if this is possible, in the scope of this project or if that should be tackled at a lower level.
I hope that this clears things up!
Thanks again
That is possible indeed but could you provide the full snippet for context! thank you!
I hope this larger example helps. This translates to the problem in my thesis. If I can help in any way just let me know! ^^
#set heading(numbering: "1.")
= Heading 1 <Heading>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet #ref(<Heading>. Lorem
ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos
et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
takimata sanctus est Lorem ipsum dolor sit amet.
== Heading 2
Some more text here.
=== Heading 3
#emph[Hello World!]
https://github.com/astrale-sharp/typstfmt/assets/57222371/65f6f7a8-eaf2-4029-a489-4915a2320370
(This also applies to typstfmt branch master standalone)
That's super weird and definitely a bug, your firsts screens were enough but i had a hard time accepting it 😂
I'm very surprised by this bug since typst should parse it as an error and we don't touch that
I'll try to fix it when i get time again (end of the month probably)
Hey! Many thanks for your work on this project which keeps my thesis nice and clean ^^' I'm not entirely sure if this is intended behavior or if this can be fixed easily. If it is intended - sorry! If it isn't I would be glad to assist to find a good solution to the problem :D Thank you very much!
Describe the bug
When having an open tag
#cite(
typst-fmt tries to inline the rest of the document (and doesn't respect boundaries like newlines, headings etc.)To Reproduce
Works on simple document
After format
The problem is that, after closing
#cite()
, typst-fmt can't reconstruct the original syntax tree.