Conversation
…k line The ALT editor is multiline, but every publish path flattened the alt value's newlines to spaces — multi-paragraph descriptions were silently destroyed at publish. - normalizeAltBreaks: CRLF → LF, trim lines, cap runs of 3+ newlines at exactly two (one blank-line paragraph gap) - buildImetaTag / withImetaAlt now preserve line breaks (covers notes, replies, recipes, forks, longform covers, products, and the edit/fork tag round-trip) - read paths (parseImeta, imetaAltByUrl) apply the same cap to alt received from any client, so runaway gaps can't balloon the layout - lightbox caption renders breaks (white-space: pre-line); the Description dialog already did - line breaks ride as real \n in the tag string: NIP-92 slots are 'key + everything after the first space', so they survive the wire (JSON escapes them) and re-parse byte-identical Tests: flatten assertions replaced with preserve/cap/CRLF/round-trip vectors; the Amethyst interop vector is unchanged and passing. Mobile parity spec: docs/accessibility/alt-text-imeta-linebreaks-mobile-handoff.md
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.
Problem
The ALT editor is a multiline textarea — we invite multi-paragraph descriptions — but every publish path flattened the
altslot's\nto a space. Authored paragraphs were silently destroyed at publish, for every reader including our own (verified against a real published note, id3f66caf7…).Fix
normalizeAltBreaks(new,src/lib/feed/imeta.ts): CRLF → LF, trims each line, caps runs of 3+ newlines at exactly\n\n(one blank-line paragraph gap), trims the ends.buildImetaTag(notes, replies, recipes, forks, longform covers, products) andwithImetaAlt(edit/fork tag round-trip).parseImeta,imetaAltByUrl): alt received from any client can't balloon the layout.white-space: pre-line(the Description dialog already usedpre-wrap).Wire format example
NIP-92 slots are "key + everything after the first space", so a real
\ninside the tag string survives the round trip: JSON escapes it on the wire, relays store it verbatim, event ids/signatures are unaffected. Built with the shipping code and parsed back byte-identical:Pre-fix, the same input published as a single flattened line.
Interop note
NIP-92 is silent on newlines; this adopts the no-invention option (raw newlines, no escape scheme). Clients parsing slots on the first space get the full multi-paragraph text; clients splitting on any whitespace see only the first line — a degraded but valid description, versus today's loss for everyone.
Mobile parity
docs/accessibility/alt-text-imeta-linebreaks-mobile-handoff.mdis an agent-facing spec for the Android/iOS apps: normative rules, reference normalization in TS/Kotlin/Swift sketches, parse requirements (first-space split), display/authoring rules, and test vectors. §1 of the main handoff doc (alt-text-imeta-handoff.md) is updated to the new wire contract.Tests
Flatten assertions replaced with preserve/cap/CRLF/JSON-round-trip/received-cap vectors (38 imeta tests) ; the Amethyst interop vector is unchanged and passing. noteReview suite green (71).