Repository navigation
Bio links, paragraph breaks, and description parsing (#137, #138) - #143
Conversation
Character and staff bios lost both their words and their shape. Markdown links rendered as invisible gaps, and every paragraph break was discarded. Sampling the 50 most-favourited characters and staff put the scale of it beyond doubt: 42 of 50 bios contain at least one link, and 47 of 50 contain a paragraph break. Links (#137) Html.FromHtml turns each anchor into a URLSpan, which ignores the label's TextColor and paints itself with the TextView's textColorLink. That resolves through Theme.MaterialComponents.DayNight to colorAccent, which colors.xml sets to transparent so the rainbow theming can show through — so link text painted transparent while still taking up its own width. BioLinkSpans swaps each URLSpan for a span that paints its own colour, which sidesteps textColorLink rather than overriding it: colorAccent stays transparent and the theming is untouched. Colour comes from the rainbow palette keyed on the link text, via a ResourceKeyFor extracted from RainbowAccentConverter so both use the same FNV-1a hash and a name always paints the same colour. Taps route in-app through AniListLinkTarget, a pure Core function: anilist.co character, anime, staff and studio links go to the matching page (162 of 235 sampled links), everything else to IExternalBrowser. Two things about the Android hook are worth knowing, because neither is visible from the code. It must be registered under a custom mapper key: Label's RemapForControls swaps LabelHandler.Mapper for a ControlsLabelMapper that defines Text and TextType itself, off Label's static init during the first page render, so a registration on those keys is shadowed and silently never runs — before or after builder.Build(). And because a custom key only runs when the handler is built, a TextWatcher re-applies the spans when the text changes; without it the links go invisible again the first time spoilers are toggled. Touch handling is a BaseMovementMethod rather than LinkMovementMethod, which extends ScrollingMovementMethod and would steal vertical drags from the page's ScrollView. Breaks (#138) AniListMarkdownProcessor now emits <br> for every newline and a doubled break for a blank line. Every newline becomes a break, lone ones included: AniList does not hard-wrap prose — across the 50 sampled bios not one lone newline fell mid-sentence — so a lone newline is always structure the author meant, most visibly the bullet lists in staff bios. The patterns match \r?\n because DescriptionParser builds prose with AppendLine, which is \n on Android and \r\n under the Windows test run. Truncation moved with it. IsTruncated was being handed the raw markdown, which counts link URLs as visible text and by construction contains none of the break tags the heuristic looks for, so that branch was dead on these pages; it now gets the rendered BioProse. CharsPerLine drops 45 to 40, since the labels render at Body2's 15sp rather than the 14sp the constant assumed. Where the estimate has to be wrong it should now err towards a redundant "Read more" rather than silently tail-truncating text the reader cannot reach. MediaDetailsPageModel carried its own copy of the whole heuristic, still at 45, behind a label identical to the bio ones; it now calls the shared helper, and a test pins it against the duplicate returning. Description parsing Four defects found while verifying the above, all pre-existing: - A ~!…!~ block spanning several stat rows only parsed in its single-line form, so the opening line failed, stat parsing ended early, and every row after it — spoiler or not — landed in the prose card. Character 40 lost three rows this way. - __Height__: (colon outside the underscores) was not recognised. A miss on the first line latches the parser into prose, so those bios lost their entire stat card, later rows in the valid spelling included. 5 of 200 sampled, Naruto, Sasuke, Kurapika and Joseph Joestar among them. - Stat row values never ran through the markdown processor, so a link in a value rendered as a literal [name](url) beside prose that rendered correctly. - _single-underscore_ italics were unhandled, leaving underscores on screen in 9 of 200 sampled bios. Verification The rendering half cannot be unit-tested, so all of it was checked on device against the live API, signed out: link colour and taps, in-app routing, scrolling over the bio, paragraph and list breaks, the spoiler toggle re-applying spans, and both parser fixes. The string half is covered by 39 new tests; the bug fixes were written red first.
There was a problem hiding this comment.
🟡 Changes recommended
The updated DescriptionParser stat-line regex appears to stop matching the existing __Label:__ value format, which would regress stat-card parsing for real bios and existing tests.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes character/staff bio rendering and interaction in AniSprinkles by preserving paragraph structure, making markdown links visible/tappable on Android, and tightening the “Read more” truncation logic so it reflects what the UI actually renders.
Changes:
- Convert AniList bio newlines to
<br>markup and extend markdown handling (e.g., underscore italics) so bios keep their intended shape (#138). - Add Android-side span replacement to recolor and route
<a>links in bios without relying on themetextColorLink(#137), plus Core URL→route resolution. - Unify description truncation heuristics across details pages and update parsing/tests for stat rows and spoiler edge-cases.
File summaries
| File | Description |
|---|---|
| tests/AniSprinkles.UnitTests/MediaDetailsPageModelTests.cs | Adds a regression test to ensure media details uses the shared truncation heuristic. |
| tests/AniSprinkles.UnitTests/DescriptionParserTests.cs | Adds coverage for broader stat-row parsing and multi-line spoiler blocks. |
| tests/AniSprinkles.UnitTests/ConverterTests.cs | Tests stability/behavior of shared rainbow accent resource key selection. |
| tests/AniSprinkles.UnitTests/CharacterDetailsPageModelTests.cs | Adds tests for spoiler + <br> interactions, stat value markdown rendering, and truncation measured on rendered bio. |
| tests/AniSprinkles.UnitTests/AniListMarkdownProcessorTests.cs | Adds tests for underscore italics and newline→<br> conversion contract. |
| tests/AniSprinkles.UnitTests/AniListLinkTargetTests.cs | New tests for mapping AniList entity URLs to in-app routes and identifying unsupported entities. |
| src/AniSprinkles/Views/StaffDetailsLoadedContentView.xaml | Renders stat values as HTML so processed markdown (including links) displays correctly. |
| src/AniSprinkles/Views/CharacterDetailsLoadedContentView.xaml | Renders stat values as HTML so processed markdown (including links) displays correctly. |
| src/AniSprinkles/Platforms/Android/BioLinkSpans.cs | New Android implementation to replace URLSpans with tappable, colored spans that route in-app or fall back appropriately. |
| src/AniSprinkles/MauiProgram.cs | Registers Android Label handler mapping (custom key) to attach bio link span behavior. |
| src/AniSprinkles.Core/Utilities/DescriptionTruncationHeuristic.cs | Recalibrates and documents the shared truncation heuristic (e.g., chars/line), and centralizes shared logic. |
| src/AniSprinkles.Core/Utilities/DescriptionParser.cs | Extends stat-row parsing to accept additional label/colon spellings and multi-line spoiler blocks. |
| src/AniSprinkles.Core/Utilities/AniListMarkdownProcessor.cs | Adds underscore italics and converts newlines to <br> markup after normalization. |
| src/AniSprinkles.Core/Utilities/AniListLinkTarget.cs | New Core utility to resolve AniList URLs to app routes and identify unsupported entity links. |
| src/AniSprinkles.Core/PageModels/StaffDetailsPageModel.cs | Measures truncation on rendered bio prose and processes stat values through markdown processor. |
| src/AniSprinkles.Core/PageModels/MediaDetailsPageModel.cs | Removes duplicate truncation heuristic and uses shared helper/constants. |
| src/AniSprinkles.Core/PageModels/CharacterDetailsPageModel.cs | Measures truncation on rendered bio prose and processes stat values through markdown processor. |
| src/AniSprinkles.Core/Converters/RainbowAccentConverter.cs | Extracts and exposes ResourceKeyFor so Android span code can share the same deterministic mapping. |
Review details
- Files reviewed: 18/27 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Two coverage gaps in the previous commit, found by auditing what it changed against what it tested. StaffDetailsPageModel got the same three changes as the character page — truncation measured on the rendered bio, the spoiler renotification, and markdown in stat row values — but every test went into CharacterDetailsPageModelTests and StaffDetailsPageModelTests had no coverage of the bio surface at all. Since #137 and #138 are about both page types, and staff bios are the ones carrying the Markdown lists and the links to agencies and other creators, that half was only ever verified by hand on device. Six tests now cover it, including the __Label__: spelling and a spoiler spanning a paragraph break. The link-tap decision — follow in-app, explain we cannot show it, or hand it to the browser — was inline in the Android span, so none of it could be tested, including the manga branch, which is a product decision rather than a technical constraint. It moves to BioLinkFollower in Core, with the span left holding only the service lookup. Thirteen tests pin the three routes, the unusable-URL cases, and the swallowed failure. The "not supported yet" message is now a shared constant, so the bio toast and DetailsPageModelBase's cannot drift. What stays untestable in BioLinkSpans is genuinely device-bound: Apply needs a real Spanned, OnTouchEvent needs a Layout, and the TextWatcher needs a live TextView. The file no longer holds any product decision. 1231 to 1250 tests. Re-verified on device after the extraction, since it changed the click path: spans still applied (1 stat row, 6 prose on staff 96881) and a tap still routes in-app.
ASpoilerSpanningPagagraphs -> ASpoilerSpanningParagraphs, matching the correctly spelled sibling and the staff equivalent. Raised in review on #143.
There was a problem hiding this comment.
🔵 Needs a closer look
DescriptionParser.StatLineRegex currently will not match the existing __Label:__ value stat-row form, which would break real-world stat parsing and contradict existing tests/expectations.
Review details
Suppressed comments (1)
src/AniSprinkles.Core/Utilities/DescriptionParser.cs:26
- StatLineRegex doesn’t match the existing stat-row spelling
__Label:__ value(colon before the closing__). With the current pattern, parsing will fail on common bios (including the existing Luffy-shape test input) and will latch the rest of the description into prose, dropping the stat card.
private static readonly Regex StatLineRegex = new(
@"^__(?<label>[^_:]+)(?::__|__\s*:)\s*(?<value>.+?)\s*$",
RegexOptions.Compiled);
- Files reviewed: 22/31 changed files
- Comments generated: 0 new
- Review effort level: Lite
* Bio links, paragraph breaks, and description parsing (#137, #138) Character and staff bios lost both their words and their shape. Markdown links rendered as invisible gaps, and every paragraph break was discarded. Sampling the 50 most-favourited characters and staff put the scale of it beyond doubt: 42 of 50 bios contain at least one link, and 47 of 50 contain a paragraph break. Links (#137) Html.FromHtml turns each anchor into a URLSpan, which ignores the label's TextColor and paints itself with the TextView's textColorLink. That resolves through Theme.MaterialComponents.DayNight to colorAccent, which colors.xml sets to transparent so the rainbow theming can show through — so link text painted transparent while still taking up its own width. BioLinkSpans swaps each URLSpan for a span that paints its own colour, which sidesteps textColorLink rather than overriding it: colorAccent stays transparent and the theming is untouched. Colour comes from the rainbow palette keyed on the link text, via a ResourceKeyFor extracted from RainbowAccentConverter so both use the same FNV-1a hash and a name always paints the same colour. Taps route in-app through AniListLinkTarget, a pure Core function: anilist.co character, anime, staff and studio links go to the matching page (162 of 235 sampled links), everything else to IExternalBrowser. Two things about the Android hook are worth knowing, because neither is visible from the code. It must be registered under a custom mapper key: Label's RemapForControls swaps LabelHandler.Mapper for a ControlsLabelMapper that defines Text and TextType itself, off Label's static init during the first page render, so a registration on those keys is shadowed and silently never runs — before or after builder.Build(). And because a custom key only runs when the handler is built, a TextWatcher re-applies the spans when the text changes; without it the links go invisible again the first time spoilers are toggled. Touch handling is a BaseMovementMethod rather than LinkMovementMethod, which extends ScrollingMovementMethod and would steal vertical drags from the page's ScrollView. Breaks (#138) AniListMarkdownProcessor now emits <br> for every newline and a doubled break for a blank line. Every newline becomes a break, lone ones included: AniList does not hard-wrap prose — across the 50 sampled bios not one lone newline fell mid-sentence — so a lone newline is always structure the author meant, most visibly the bullet lists in staff bios. The patterns match \r?\n because DescriptionParser builds prose with AppendLine, which is \n on Android and \r\n under the Windows test run. Truncation moved with it. IsTruncated was being handed the raw markdown, which counts link URLs as visible text and by construction contains none of the break tags the heuristic looks for, so that branch was dead on these pages; it now gets the rendered BioProse. CharsPerLine drops 45 to 40, since the labels render at Body2's 15sp rather than the 14sp the constant assumed. Where the estimate has to be wrong it should now err towards a redundant "Read more" rather than silently tail-truncating text the reader cannot reach. MediaDetailsPageModel carried its own copy of the whole heuristic, still at 45, behind a label identical to the bio ones; it now calls the shared helper, and a test pins it against the duplicate returning. Description parsing Four defects found while verifying the above, all pre-existing: - A ~!…!~ block spanning several stat rows only parsed in its single-line form, so the opening line failed, stat parsing ended early, and every row after it — spoiler or not — landed in the prose card. Character 40 lost three rows this way. - __Height__: (colon outside the underscores) was not recognised. A miss on the first line latches the parser into prose, so those bios lost their entire stat card, later rows in the valid spelling included. 5 of 200 sampled, Naruto, Sasuke, Kurapika and Joseph Joestar among them. - Stat row values never ran through the markdown processor, so a link in a value rendered as a literal [name](url) beside prose that rendered correctly. - _single-underscore_ italics were unhandled, leaving underscores on screen in 9 of 200 sampled bios. Verification The rendering half cannot be unit-tested, so all of it was checked on device against the live API, signed out: link colour and taps, in-app routing, scrolling over the bio, paragraph and list breaks, the spoiler toggle re-applying spans, and both parser fixes. The string half is covered by 39 new tests; the bug fixes were written red first. * CI: Update UI screenshots [skip ci] * Cover the staff bio surface and move the link-tap decision into Core Two coverage gaps in the previous commit, found by auditing what it changed against what it tested. StaffDetailsPageModel got the same three changes as the character page — truncation measured on the rendered bio, the spoiler renotification, and markdown in stat row values — but every test went into CharacterDetailsPageModelTests and StaffDetailsPageModelTests had no coverage of the bio surface at all. Since #137 and #138 are about both page types, and staff bios are the ones carrying the Markdown lists and the links to agencies and other creators, that half was only ever verified by hand on device. Six tests now cover it, including the __Label__: spelling and a spoiler spanning a paragraph break. The link-tap decision — follow in-app, explain we cannot show it, or hand it to the browser — was inline in the Android span, so none of it could be tested, including the manga branch, which is a product decision rather than a technical constraint. It moves to BioLinkFollower in Core, with the span left holding only the service lookup. Thirteen tests pin the three routes, the unusable-URL cases, and the swallowed failure. The "not supported yet" message is now a shared constant, so the bio toast and DetailsPageModelBase's cannot drift. What stays untestable in BioLinkSpans is genuinely device-bound: Apply needs a real Spanned, OnTouchEvent needs a Layout, and the TextWatcher needs a live TextView. The file no longer holds any product decision. 1231 to 1250 tests. Re-verified on device after the extraction, since it changed the click path: spans still applied (1 stat row, 6 prose on staff 96881) and a tap still routes in-app. * CI: Update UI screenshots [skip ci] * Fix a typo in a test name ASpoilerSpanningPagagraphs -> ASpoilerSpanningParagraphs, matching the correctly spelled sibling and the staff equivalent. Raised in review on #143. * CI: Update UI screenshots [skip ci] --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>









Closes #137. Closes #138.
Character and staff bios lost both their words and their shape: every markdown
link rendered as an invisible gap, and every paragraph break was discarded.
Sampling the 50 most-favourited characters and staff settled the scale — 42 of 50
bios contain a link, 47 of 50 contain a paragraph break.
Links (#137)
Html.FromHtmlturns each anchor into aURLSpan, which ignores the label'sTextColorand paints itself with the TextView'stextColorLink. That resolvesthrough
Theme.MaterialComponents.DayNighttocolorAccent, whichcolors.xmlsets to transparent so the rainbow theming can show through — hence link text
painted transparent while still occupying its own width.
BioLinkSpansswaps eachURLSpanfor a span that paints itself, whichsidesteps
textColorLinkrather than overriding it:colorAccentstaystransparent and the theming is untouched. Colour comes from the rainbow palette
keyed on the link text, through a
ResourceKeyForextracted fromRainbowAccentConverterso a name always paints the same colour wherever itappears. Taps route in-app via
AniListLinkTarget, a pure Core function — AniListcharacter, anime, staff and studio links reach the matching page (162 of 235
sampled links), everything else goes to
IExternalBrowser.Two non-obvious things about the Android hook, both of which cost a device
cycle to find and neither of which is visible from the code:
Label.RemapForControlsswaps
LabelHandler.Mapperfor aControlsLabelMapperthat definesTextandTextTypeitself, offLabel's static init during the first page render — so aregistration on those keys is shadowed and silently never runs, before or after
builder.Build(). No error, links simply stay invisible.TextWatcherre-applies the spans on text change. Without it the links go invisible again
the first time spoilers are toggled.
Touch handling is a
BaseMovementMethod, notLinkMovementMethod— the latterextends
ScrollingMovementMethodand would steal vertical drags from the page'sScrollView.
Breaks (#138)
AniListMarkdownProcessoremits<br>per newline and a doubled break for ablank line. Every newline becomes a break, lone ones included: AniList does
not hard-wrap prose — across the 50 sampled bios not one lone newline fell
mid-sentence — so a lone newline is always deliberate structure, most visibly the
bullet lists in staff bios. This reverses the direction #138 originally leaned
towards, and the reasoning is recorded on the issue. Patterns match
\r?\nbecause
DescriptionParserbuilds prose withAppendLine.Truncation moved with it.
IsTruncatedwas being handed the raw markdown, whichcounts link URLs as visible text and contains none of the break tags it looks
for, so that branch was dead here; it now receives the rendered
BioProse.CharsPerLinedrops 45 → 40 forBody2's real 15sp, so the estimate now errstowards a redundant "Read more" rather than silently tail-truncating text the
reader cannot reach.
Beyond the two issues
Flagged during review and on device, each agreed before it went in:
MediaDetailsPageModel~!…!~block spanning several stat rows only parsed single-line, so stat parsing ended early and later rows fell into the prose card. Character 40 lost three rows.__Height__:spelling[name](url)beside prose that rendered correctly._italic_snake_caseis untouched.Manga links are deliberately not routed: the details page queries
Media(type: ANIME), so a manga id 404s there. They show the same "not supportedyet" message
NavigateToMediaalready gives, and the removal steps are recordedon #12.
Verification
The rendering half cannot be unit-tested, so it was checked on device against the
live API, signed out — Luffy, Eiichirou Oda and Naruto Uzumaki:
BIOLINK replaced 6 / 4 / 2 link span(s)matchingthe counts predicted from the API
NAVTRACE BioLink → character-details with id=12281__Trivia:__bullet list render correctlyreplaced 2thenreplaced 5once revealed(a _Jinchuuriki_)renders italicThe string half adds 58 tests (1192 → 1250). Bug fixes were written red first;
the four spoiler-interaction tests passed on the first run, so they pin existing
correct behaviour rather than fixing anything.
The link-tap decision — follow in-app, explain we can't show it, or hand it to the
browser — lives in
BioLinkFollowerin Core rather than in the span, so all threeroutes are tested, the manga branch included. What is left in
BioLinkSpansisgenuinely device-bound:
Applyneeds a realSpanned,OnTouchEventneeds aLayout, and theTextWatcherneeds a liveTextView. That file holds noproduct decision.
Review notes
Scope is wider than the two issues — every addition was raised and agreed, but
the
MediaDetailsPageModelchange has the largest blast radius and is the oneworth a second look.
The second commit is coverage rather than behaviour:
StaffDetailsPageModelhadreceived the same three changes as the character page while every test went to the
character side, and
StaffDetailsPageModelTestshad no coverage of the bio surfaceat all. Since both issues are about both page types, that half had only ever been
checked by hand. It also moves the link-tap decision into Core so it can be tested,
and re-verifies on device afterwards, since that changed the click path.