astrale-sharp / typstfmt

Apache License 2.0
253 stars 25 forks source link

Indentations get collapsed #69

Closed g-simmons closed 1 year ago

g-simmons commented 1 year ago

First of all, thank you - having a formatter for typst is a blessing.

I installed via cargo

When I format the following content:

#set page()

- *Content*
  - Text
  - Math
  - Layout
  - Visualize
  - Meta
  - Symbols

It turns into:

#set page()

- *Content*
- Text
- Math
- Layout
- Visualize
- Meta
- Symbols

This can probably be worked around by using the alternative syntax here, but it would be nice to be able to use the shorthand.

Cheers

g-simmons commented 1 year ago

Actually this also seems to get dedented:

From

- *Compute*
  #list(
    [Foundations],
    [Calculate],
    [Construct],
    [Data Loading],
  )

To

- *Compute*
#list(
  [Foundations],
  [Calculate],
  [Construct],
  [Data Loading],
)

Which un-nests the list in the rendering.

joeldierkes commented 1 year ago

This is the general problem I also encountered, not just with sub lists:

Before typstfmt

- Never gonna give you up
  Never gonna let you down

After typstfmt

- Never gonna give you up
Never gonna let you down

Which are two different things in typst.

astrale-sharp commented 1 year ago

Thank you very much for the report! I'll get to work on it on Mondays when i get back! It shouldn't be too hard to fix ( 6 or 7 loc ;) )

astrale-sharp commented 1 year ago

This should be fixed, I'm closing this but don't hesitate to reopen it if it doesn't work for you!