A list item carrying an own-line hard break is written at column 0, so its continuation indent is lost

Open
#312 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Tech stack
ruby, typescript
Domain
tooling

Research direction

Read parser.rb lines 2721-2733 and the context from #304, then review related issues #301 and #307. Compare the affected reparse-ledger and inline-sweep idempotency witnesses; done means a maintainer rules whether column 0 is the accepted normal form and records the family's disposition.

Written by the indexing model from the issue text.

Description

conformance mechanism:reflow-join obligation:model-fidelity

What happens

After #304, an item whose text holds a line that is only + (a hard break on its own line) is written with all of its text lines at column 0 instead of under the marker text:

* a
  b +
   +
  c

formats to * a\nb +\n +\nc\n. Render-equal in both programs and a fixed point; the source's continuation indent is gone. The reparse ledger records the 14 rows under the family indent-dropped-for-a-break, standing open on this issue.

Why

Ruby's adjust_indentation! (parser.rb l.2721-2733) strips the least indent from an indented item body before HardLineBreakRx reads a line. The break's line is written as the bare two-byte image; if the item's other lines stand under the marker text, that line is the least indented one and the strip eats the space that spells the break. One line at column 0 cancels the strip for the whole item, which is what the column-0 spelling buys.

The alternative, measured (Sep 7, the #304 lane)

Keep the item's text at the marker column and write the break's line one column past it. For an item's own lines that round-trips every witness. But the indent is then copied into a byte-preserved span's interior (a monospace span or passthrough spanning the break), which grows on every pass: 2, 4, 6 columns. Cost: 63 inline-sweep HardLineBreak/in-mono/idempotency rows (7 failing to 70) and the reparse population 121 to 182 breaches, 99 unclassified. Column 0 is the cheaper loss.

Ruling requested

Whether a list item's continuation indent is worth preserving at that price, or whether the column-0 spelling is the accepted normal form for an item carrying an own-line break (in which case this family's standing becomes a ruled loss and the rows do not expire). Default unless vetoed: column 0 is the normal form.

Related

#304, #301, #307.

Dominant language
TypeScript
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from oxidecomputer/prettier-plugin-asciidoc

All issues in oxidecomputer/prettier-plugin-asciidoc

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.