oxidecomputer / oxidecomputer/prettier-plugin-asciidoc

An indented setext title under a substituting directive opens a literal block and loses the section

Open
#339 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

conformance mechanism:block-reading obligation:meaning-preservation tier-1
Dominant language
TypeScript
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Found by the #327 review (verified at f22f1ded and at its base 5b510b4b: render-different under both programs at both, so not a regression of #327).

ifdef::x[body]
 Title
-----
more

With x undefined, Asciidoctor Ruby 2.0.26 and @asciidoctor/core 4.0.11 both read <h2 id="_title"> Title</h2> plus <p>more</p>. The formatter writes

ifdef::x[body]
 Title

----
more
----

which both programs read as a literal block plus a listing block. Same for Title over ------ and for the pair with no more line.

Mechanism. The indented line opens a literal delimitedBlock, not a paragraph, so BlockReading.openingLine (#309) is never recorded and neither half of #327's pair rule (underlinesTheTitleAbove, src/print/join.ts) can fire. The two-readings fact exists only on prose blocks.

Relation to #207. #207 is the no-directive case and loses only the leading space; this one loses the structure. Related to #327 (the unindented pair, fixed) and #328 (delimiter directly under the directive).

Closes when the indented first line under substituted content records its two readings the way a paragraph does (or the literal-paragraph reader declines the line where the deleted reading is a setext title) and the pair is written back; red-first pins for the three shapes above; render-equal under both programs; fixed point.

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.

Research direction

Start by tracing the literal delimitedBlock reader and the pair-handling logic in src/print/join.ts, focusing on why openingLine is not recorded for the indented line under substituted content. Add red-first coverage for the three shapes described, then verify render equality under Asciidoctor Ruby and @asciidoctor/core and confirm the formatter reaches a fixed point.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.