oxidecomputer / oxidecomputer/prettier-plugin-asciidoc
A hardbreaks block loses a rendered break when a lone + is fused onto the next word
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
What happens
In a :hardbreaks: document, every source newline in a paragraph renders as <br> (whitespace row A5). A lone + word must not end an output line (it would read as a hard break), so isDangerousAtLineEnd fuses the next word onto it. That fusion overrides a run the record held as a newline, and the rendered <br> is lost:
:hardbreaks:
* a
+
y
renders a<br> +<br> y; the formatter writes * a\n + y, which renders a<br> + y.
How it was found
The #304 lane measured a 1,152-case population (item text x {indented text, lone + at three columns, a trailing + line} x with/without :hardbreaks:). Main fails 344 of them (153 are this mechanism, all fidelity); the #304 change fails 136: 226 leave, 18 arrive, and every arrival is a :hardbreaks: document. The mechanism predates #304; #304 widens its reach from a + on the item's first continuation line to a + anywhere in the item's text.
Mechanism
The correct output needs the + to open AND close a line of its own, which needs both of its runs at once plus the item's continuation column, which wordsToAtoms does not have.
Candidate fix (a subtraction)
A hardbreaks block may never be re-laid-out at all, so make it a replayed block (a whole-block blockWhitespace row) instead of binding each run. That would delete row A5.
Ruling to take with it
Whether a lone + line inside a hardbreaks list item is a shape an author types. If not, this closes as contrived with the witness kept.
Related
#304, #301, #300.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the hardbreaks witness, then trace how isDangerousAtLineEnd and wordsToAtoms handle the lone + and newline runs. Decide whether the hardbreaks block should be replayed or the shape should be ruled contrived; done requires a maintainer decision and a regression check for the chosen outcome.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100