Skip to content

Rebase inline example assets to the published folder; document D22 illustrations - #70

Closed
zabarov wants to merge 1 commit into
mainfrom
fix/inline-example-assets-d22
Closed

zabarov wants to merge 1 commit into
mainfrom
fix/inline-example-assets-d22

Conversation

@zabarov

@zabarov zabarov commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Problem

A shared example (:::example {id=...}) admitted inline into the page has no <base href>, unlike its frame. A path like assets/photo.svg in its markup resolved against the page address and returned 404. Consumers worked around it with preview=sandbox (for example ui-doc's image-field, avatar, file-preview, list-item and property-types gallery examples).

Change

  • New InlineExampleAssetRebaser: before inline markup joins the page, references to the example's own asset paths in tag attribute values are rewritten to <base_url>/_docara/examples/<id>/. Covered: plain URL attributes, srcset lists, url() in a style, paths inside JSON attribute values (including \/-escaped ones), ./assets/..., HTML-escaped names, and query or fragment suffixes. Text content, unknown files, ../assets/..., absolute and external URLs stay as written.
  • ProjectExampleRepository::load() also returns the example's asset paths.
  • The source tab and the hidden full-screen frame are unchanged. The frame keeps its <base href>.
  • Docs (components/example.md, ru): a paragraph on how inline examples reach assets/, and a new "Картинки в примерах" subsection with the documentation illustration rule (SIMAI rule D22).
  • CHANGELOG (Unreleased: Fixed and Documentation). Component source metadata recaptured.

Checks

  • vendor/bin/pint --test: passed
  • vendor/bin/phpunit tests/Unit: 1026 tests passed, 5 skipped. This includes the new InlineExampleAssetRebaserTest and ProjectExampleRepositoryTest::an_inline_project_example_points_its_own_assets_at_the_published_folder.
  • docs/site: build production and verify-static: 491 pages, 0 broken references.
  • The full root suite (about an hour, whole-site builds) was not run locally. CI runs it.

🤖 Generated with Claude Code

…22 illustrations

A shared example admitted inline into the page has no <base href> of its
own, so "assets/photo.svg" resolved against the page address and returned
404. Before the markup joins the page, references to the example's own
assets in attribute values (plain URL, srcset, url() in a style, a path
inside a JSON attribute) now point at /_docara/examples/<id>/. Text and
paths to files the example does not have stay as written; the source tab
still shows what the author wrote.

The example component page explains this and adds the documentation
illustration rule (SIMAI rule D22): flat SVG from the pinned SIMAI
Framework palette, sets, shapes, names, alt text and generate.mjs sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zabarov added a commit that referenced this pull request Nov 17, 2026
…22 illustrations

From PR #70 (fix/inline-example-assets-d22). On top: the D22
text says it is a SIMAI documentation rule Docara does not check, and the
English page carries the same two parts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zabarov

zabarov commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Released in Docara 3.17.0 via local main (bb80ec8, plus English page and D22 wording).

@zabarov zabarov closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant