Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Line wrapping before number at end of sentence incorrectly creates numbered list #164

Open
1 task done
martin-walls opened this issue Apr 1, 2024 · 1 comment
Open
1 task done

Comments

@martin-walls
Copy link

martin-walls commented Apr 1, 2024

  • I have tested with the master version of typstfmt and not just typst-lsp

Describe the bug
When a sentence ends with a number immediately before the period, this can get wrapped onto a new line.
This happens when the number is exactly at the line length limit.
When this happens, the Typst compiler interprets it as the start of a numbered list, and therefore the output for the rest of the paragraph is incorrect.

To Reproduce
Minimal example:

This is a paragraph containing a line that happens to end in a number, which is 4. Typstfmt does not format this correctly.

With the default settings, Typstfmt formats this as

This is a paragraph containing a line that happens to end in a number, which is
4. Typstfmt does not format this correctly.

Expected output:
good

Actual output:
bad

@astrale-sharp
Copy link
Owner

Hey there!
Oh that's a problem alright, we're possibly going to need logic that checks if breaking the line at a point starts a new line with a number, - or similar ast breaking characters.

In the meantime I would advise disabling line breaking

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants