oxidecomputer / oxidecomputer/prettier-plugin-asciidoc

A preprocessor directive between a setext title and its underline hides the title

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

Nobody has claimed this yet.

mechanism:block-reading obligation:model-fidelity syntax-gap tier-2
Dominant language
TypeScript
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Split out of #16, which closed with the two-line title reading. is_next_line_section? calls reader.peek_lines 2, and a PreprocessorReader peek runs the directive machinery first, so a directive standing between a title and its underline is gone by the time the pair is compared:

Section Title
ifdef::asciidoctor[]
-------------
endif::[]

Asciidoctor reads a level-1 section Section Title; we read a paragraph, the two directives, and a listing block the ------------- opens. Our nextLine is the RAW line below, not the preprocessed one.

The fix is not just a preprocessor-aware peek. A formatter never resolves a conditional, so the directives have to survive into the output, and == Section Title followed by the directive pair puts ------------- at a block start where it opens a listing block again. Any repair has to decide what to emit for a title whose underline is conditional.

Corpus cases (quarantined on fidelity, tagged #16 in tests/conformance/quarantine.json):

  • sections_test.rb#should preprocess second line of setext section title#0
  • sections_test.rb#should preprocess second line of setext discrete heading#0

Ledger family gap:setext-title (scripts/block-structure-corpus.json), 2 entries.

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 with is_next_line_section? and reader.peek_lines 2, then trace how PreprocessorReader handles the directive before the setext title comparison. Review the two quarantined cases in tests/conformance/quarantine.json and the gap:setext-title entries in scripts/block-structure-corpus.json. Done means deciding and validating how a conditional underline and its directives are represented without creating a listing block.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.