Repository navigation
feat(renderer): typed field values in themes (RFC-0041 step 6) - #99
Merged
Merged
Conversation
- core-ts/fields: formatFieldValue, plain text per type and locale. - astro-renderer: entryFields / renderFields (rich text through the body Markdown pipeline, URLs through safeHref, images as image attributes with the asset's alt), GraphSource.entryFields on live and snapshot sources, and EntryFields.astro (a <dl>, nothing when empty). Additive only. - Starter: the article shows its fields; entries without definitions render byte-identically. - Old-theme compat test also builds a frozen v0.4.0 theme, with a collection that has fields. - docs/guides/fields.md; renderer README; AGENTS.md layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Madraka <8898640+Madraka@users.noreply.github.com>
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.
Step 6, the last step of RFC-0041's rollout (ADR-0043), built on #94–#98.
API (additive only)
@cloudhal/core-ts/fields:formatFieldValue(value, def, {locale, defaultLocale?, timeZone?, words?}), plain text per type, as RFC §9 says.@cloudhal/astro-renderer/fields, also re-exported from the root:entryFields(source, entry, options?)andrenderFields. Rich text goes through the bodies' Markdown pipeline, URLs throughsafeHref(an unsafe one is dropped), images become image attributes with the asset's alt in the page's language, and a datetime keeps its zone.resolveFields,fieldLabelandoptionLabel.GraphSource.entryFields?, implemented by both the live and snapshot sources; optional, so older sources still type-check.EntryFields.astro: a<dl class="ch-fields">with one.ch-field[data-field][data-type]per field that has a value, and nothing when none does. No CSS; themes style it.Starter: the article shows its fields under the cover, and the original's cache tag is added when a value comes from it. Entries without definitions render byte-identically.
Compatibility: the old-theme test now also builds a frozen copy of the v0.4.0 theme. Before building, it adds a collection with fields, and checks that the old themes still render that entry.
Docs:
docs/guides/fields.md(defining fields, operations, localization, theme usage, security), the renderer README, and the AGENTS.md layout.Tests
onerror,javascript:,java\tscript:), translation and language-edition cases, and live/snapshot parity.EADDRNOTAVAIL, same on clean main.<article>is byte-identical.Changeset: minor (
astro-renderer,core-ts,cli).🤖 Generated with Claude Code