astrale-sharp / typstfmt

Apache License 2.0
253 stars 25 forks source link

bold + comment ends up creating incorrect typst code #161

Open Doublonmousse opened 7 months ago

Doublonmousse commented 7 months ago

[x] I have tested with the master version of typstfmt and not just typst-lsp

Describe the bug Formatting with comments and bold end up creating *// symbols that are not correct typst code

To Reproduce Format the following file

start *test and
 going on 
and on*
//comment and on

and obtain

start *test and going on and on*//comment and on

that won't compile because of the *//

astrale-sharp commented 7 months ago

Hey there! very interesting, we might try to find a fix but honestly if text// parses, there is no reason *text*// shouldn't, So I consider this a typst parser bug, might open a PR tomorrow or today ;)

astrale-sharp commented 7 months ago

Apparently it's a feature! https://github.com/typst/typst/issues/3735#issuecomment-2009776984 Then we need to respect this!

It's weird formatting anyway cause start *text* // is prettier anyway