oxidecomputer / oxidecomputer/prettier-plugin-asciidoc

The conditional-directive line pattern diverges from ConditionalDirectiveRx in both directions, and a leading-whitespace body's literal reading is lost

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

Nobody has claimed this yet.

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

Description

What happens

CONDITIONAL_DIRECTIVE in src/parse/line-shapes.ts diverges from Ruby's ConditionalDirectiveRx in both directions, with render-moving witnesses (Ruby 2.0.26 and @asciidoctor/core 4.0.11 agree on each):

  • ifdef::a b[] / ___: our target class [^\[]* accepts a space that Ruby's \S*? refuses, so we read a directive where the reference reads paragraph text, and the layout break under it is canonicalized on a line the reference reads inside a paragraph.
  • ifdef::x[a]b[] / ___: our text class [^\]]* refuses a ] that Ruby's (.+)? accepts, so we read paragraph text where the reference reads a directive with the body a]b.
  • A body with LEADING whitespace, ifdef::backend[ x], is substituted by the reference as x and opens an indented literal block; our reading moves the render (differently before and after the #229/#230/#231 change, which fixed only the trailing-whitespace case).

Pre-existing on main; found by the #229/#230/#231 review (2026-09-06). Fix: spell the pattern from rx.rb's ConditionalDirectiveRx (cite the line), measure the boundary shapes through both programs, and give the substituted body the reference's literal reading when it starts with whitespace.

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 in src/parse/line-shapes.ts and compare CONDITIONAL_DIRECTIVE with ConditionalDirectiveRx in rx.rb, then measure the three boundary cases against Ruby and @asciidoctor/core. Done means the pattern agrees in both directions and a substituted body with leading whitespace receives the reference literal reading, including the render outcomes.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.