astrale-sharp / typstfmt

Apache License 2.0
251 stars 25 forks source link

Formatter does not respect `max_line_length` directive #119

Open drupol opened 8 months ago

drupol commented 8 months ago

Hi,

As promised on Discord, here's the issue regarding the max_line_length.

When configuring the max_line_length parameter to 80 characters in the configuration file, the formatter still produces lines that exceed 80 characters. IMHO, This behaviour is inconsistent with the expected output.

Example:

- Runnability: A researcher using any machine is able to re-run an experiment and obtain constant results

Is formatted into:

- Runnability: A researcher using any machine is able to re-run an experiment and
  obtain constant results

And the line starting with - Runnability:... is greater than 80 chars.

astrale-sharp commented 8 months ago

Thanks !

More context : Right now, the first line of a node (markup, code, etc) won't respect max_length

#[ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
  incididunt ut labore et #[ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
    incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
    nostrud exercitation ullamco laboris ] dolore magna aliqua. Ut enim ad minim
  veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
  consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
  dolore eu fugiat nulla ]