feat: render wire fences in the browser with static rendering opt-in - #82
Merged
Merged
Conversation
- offset Wire diagnostic columns by the fence marker's column so errors in fences nested in lists or blockquotes point at the right character - look up the primary diagnostic once in render-wire - cover the rehypeWire failure path and indented fences in tests - make the MDX version assertion survive release bumps - note the remark-stringify limitation in the README
Owner
Author
ReviewReviewed the full diff. The design is sound and consistent with the repo's conventions: structured HAST instead of raw HTML matches ADR 0019, the package layout/build config mirrors Fixed and pushed (044a295)
117 tests pass; lint/typecheck clean. Notes, no change needed
|
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.
Summary
Wire fences now render asynchronously in the browser after HTML is ready by default. A documentation site initializes
@wire-lang/browseronce; authors then write ordinary fencedwireblocks. Sites that need finished SVG without client JavaScript can opt into ahead-of-time rendering through@wire-lang/markdown.Standard
pre > code.language-wireoutput needs no Wire Markdown plugin.remarkWireandrehypeWirepreserve source by default;{ mode: "static" }replaces fences with structured inline SVG during the build. MDX supports the same static option, or browser rendering after hydration.Closes #36
Implementation
@wire-lang/browserwith asynchronousinitialize(),run(), andrender(source)APIs. Its standalone ESM bundle includes core and loads without an import map or bundler.pre.wire-lang/code.wire-lang. Preserves and hides successfully rendered source, inserting a sibling SVG container.run()after navigation or content updates.0.3.1.mainand uneven-indentation review findings remain resolved.Validation
pnpm release:check: lint, documentation formatting, typecheck, 146 tests across 14 files, build, production dependency audit, package dry runs, and installed-package smoke checks.mainthrough core, browser rendering, and both static plugins. Core/browser SVG strings and rendered PNG comparisons match.pnpm skill:checkand skill frontmatter validation.checkand Securityauditpassed onc9f467e. GitHub reports the PR clean and mergeable.Rendered comparisons
The final schematic drawing is unchanged; rendering now happens after HTML loads unless static mode is selected. These images use the bundled SVG renderer on the same source, with
mainon the left and the browser renderer on this branch on the right. PNGs are hosted separately ondemo/browser-render-assetsunderdocs/assets/browser-render/and are absent from this PR's diff.Release impact
New browser APIs and the Markdown rendering modes are documented. Configure npm trusted publishing for both
@wire-lang/browserand@wire-lang/markdownbefore the first release tag. Browser mode requires client initialization; plugin installation alone does not inject a runtime. Static mode requires{ mode: "static" }explicitly.Renderer architecture tradeoffs will be investigated separately in #112; that investigation is not a merge prerequisite.