Inline parser & better parity with stock renderer#54
Merged
Conversation
…mbers only STATUS.md no longer enumerates failing docs (some RFDs are public) — totals and category counts only. CONTEXT.md carries the durable parity workflow extracted from HANDOFF, minus the historical fix log.
Bug 1 — straddling `pass:q[…]` corrupted when overrides registered
`src/asciidoc/RenderInline.tsx` — `useInlineRenderMode` now returns `react: !hasRawInline(nodes)` unconditionally. Removed the now-unused `hasOverrides` computation and rewrote the two doc comments (the function header and the `hasRawInline` header) to document the new behavior and state the trade-off you called out: an override targeting a node *inside* a straddling run won't apply, which is rare and cosmetic, versus the old behavior corrupting visible content.
## Bug 2 — `\email@email.com` kept its backslash
`src/asciidoc/inline/parser.ts:1487` — the bare-email handler now special-cases `prefix === '\\'`, returning `{ type: 'text', text: m[0].slice(1) }` (backslash stripped, unlinked). The `> : /` lead chars still `return null` (whole match left literal), and the comment now distinguishes the escape case from the genuine non-linking-context cases.
React 19 hydration fix on June 5 that added `<tbody>` to the admonition/colist/dlist/hdlist table templates but never updated the test normalizer to account for it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a vendored TypeScript port of Asciidoctor's inline substitution pipeline (
src/asciidoc/inline/). Previously, inline content was a raw HTML string fromgetContent()passed throughdangerouslySetInnerHTML. NowprepareDocumentruns the full six-pass substitution pipeline (specialcharacters → quotes → attributes → replacements → macros → post-replacements) and produces anInlineNode[]AST that templates can render as a real React tree.The main payoff is
inlineOverrides: consumers can now swap in their own React components for individual inline node types (links, xrefs, footnotes, images, kbd, etc.) without owning the whole block template.Parity with stock Asciidoctor goes from ~85% to ~95% across a corpus of ~2000 real documents (cannot include in the repo directly). The remaining ~5% is documented in the README's "Known differences" section — mostly the two
#-in-code cases, a placeholder-leak bug, and some footnote edge cases.Other things in this PR:
RenderInlinecomponent for rendering inline ASTs as React elements, with adangerouslySetInnerHTMLfallback for passthrough HTML that straddles sibling nodesRenderInline/useInlineRenderMode()instead ofhtml-react-parser<<Section Title>>), xref style overrides, and bibliography xrefs with external URL and citation body on the anchor node{set:cellbgcolor}, not implemented)Fixes #44
Canary:
npm install @oxide/react-asciidoc@1.3.0-canary.5535dcb