Skip to content

fix(site): add explicit whitespace between inline elements - #54

Merged
maehr merged 1 commit into
textrefs:stagingfrom
maehr:fix/53-inline-whitespace
Jul 31, 2026
Merged

fix(site): add explicit whitespace between inline elements#54
maehr merged 1 commit into
textrefs:stagingfrom
maehr:fix/53-inline-whitespace

Conversation

@maehr

@maehr maehr commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Fixes the missing-whitespace defect reported in #53.

Cause

Astro applies JSX whitespace rules to .astro templates — including the top-level HTML template, not just .map() bodies. A text node's leading/trailing whitespace is deleted when it contains a newline, so a line break between two inline elements yields no whitespace text node. <p>\n a,\n <strong>b</strong> renders as a,b.

CSS masks part of it (.reg-tag { margin-right: .4rem }, flex gap), but the document text stays wrong for copy/paste, assistive technology, text extraction and the Pagefind search index.

Fix

Explicit {' '} separators — already the idiom in this repo (src/components/RegistrySnapshot.astro). No wording, markup or styling changes.

  • src/pages/reg/index.astro — the five prose cases from the issue (cited),citation systems, SeeURL layout, for how/id/, and/api/ fit, or thespecification).
  • All four record templates (/id/work/, /id/system/, /id/mapping/, /id/ref/) — the .reg-sub header, where the record IRI ran into the JSON link (…aristotle.nicomachean-ethicsJSON) and the type/status chips ran into each other.
  • /id/ref/ and /id/mapping/ label↔value pairs (Work:, Citation system:, Subject:, Target:).
  • /id/ref/ transcription chips (provider link ↔ edition ↔ access ↔ license), /id/work/ mapping rows (two adjacent anchors).
  • Paginated reference lists (/reg/work/…/refs/, /reg/system/…/refs/) — back-link ↔ draft chip.
  • AliasList.astro, and the RecordPage.astro site header (TextRefsUnstable preview). Whitespace-only text nodes are ignored in flex layout, so the flex headers are unchanged visually.

Verification

npm run verify:fast green. Built output re-scanned:

$ grep -o 'The TextRefs registry holds.*data model\.' dist/reg/index.html | sed 's/<[^>]*>//g'
The TextRefs registry holds works (texts that get cited), citation systems (rules for …
… See URL layout for how /id/, /reg/, /cite/, and /api/ fit together, or the specification for the data model.

$ grep -rlE '</code><a|</span><a|</a><span|</span><code' dist/id/ dist/reg/
(no matches)

Targets staging, so it rides along in release PR #4.

Closes #53

🤖 Generated with Claude Code

Astro applies JSX whitespace rules to templates, so a newline between two
inline elements collapses to no whitespace text node at all. Registry pages
rendered "cited),citation systems", "SeeURL layout" and record IRIs glued to
the JSON link. CSS margins masked some cases visually, but the document text
stayed wrong for copy/paste, screen readers and the Pagefind index.

Add explicit {' '} separators across the registry index, all four record
templates, the paginated reference lists, the alias list and the record
layout header.

Closes textrefs#53

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@maehr
maehr merged commit e0b6ef1 into textrefs:staging Jul 31, 2026
2 checks passed
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