fix: artist bio rendering on artwork screen - #13851
Conversation
simple-markdown's heading rule only matches `### foo` when it's followed by a blank line. Some content (e.g. user- or admin-authored artist bios) often puts a heading directly above its content with no blank line, so the heading rule never fired and the literal `###` leaked into the rendered text via the paragraph fallback rule. Fix: Normalize the input to insert the blank line before parsing. Co-Authored-By: Claude Sonnet 5 <[email protected]>
ReadMore's `list` rule spread `...basicRules.paragraph` instead of `...basicRules.list`, a copy-paste bug that gave it paragraph's match/order instead of the real list parser. This made the parser treat a whole `- item` block as one inline blob (alphabetical tie-break with paragraph), so list items rendered as wrapped plain text with literal `- ` prefixes and no hanging indent between the bullet and wrapped continuation lines. Fix the rule to extend the real `basicRules.list`, and render each item as its own bullet + content row. Also switch the bullet glyph from `-` to `•` in both ReadMore and the shared `defaultRules()` list renderer, and give list blocks their own trailing margin, since list parsing consumes its own trailing blank line and therefore never gets the implicit spacer that other blocks get from a leftover `newline` node. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Biography's existing implementation was the result of a bugfix #9840 which… (a) had issues, since its DIY truncation code could break text inside of html tags or entities, potentially resulting in broken markup rendering. (b) is no longer needed, since `ReadMore` now correctly renders the hyperlinks that were observed to be missing in the bug report DIA-458. We now switch the query to `biographyBlurb(format: MARKDOWN)` and render through the widely used `ReadMore` component, which truncates on the parsed tree instead of the raw string, and has improved heading and list rendering thanks to the previous commits. Co-Authored-By: Claude Sonnet 5 <[email protected]>
95e9032 to
c05a201
Compare
|
Summary Fixes markdown rendering in The Three things worth a look before merge. Issues Found 🟡 Important 1. Preprocessing the raw string applies everywhere Fixing this at the rule level sidesteps it: block parsing is sequential, so once the parser reaches the opening fence the 2. Headings ignore the return (
<Text mb={1} key={state.key} variant={variant}>
{output(node.content, state)}
</Text>
)
3. The
🟢 Suggestions
Areas Reviewed Architecture — Standardizing on Bugs and edge cases — I traced Testing — Good additions. The ordered-list test covering a custom Questions for Author
|
|
I'm going to punt on Opus's final suggestions here as too edge-casey / out of scope / preexisting. (I'm finding these Opus 5 reviews to be a bit overzealous tbh!) Ready for review now cc @artsy/diamond-devs |
This PR resolves DI-346
Assisted-by: Claude:Sonnet-5
Description
After getting bullied by Opus on #13842 I slept on it and decided on a different approach — fix the
ReadMorecomponent's Markdown rendering. This way the Artwork screen'sAboutArtistcomponent can benefit from that fix while remaining untouched itself.In a nutshell:
ReadMorecomponent instead of relying on that one-off fix)Listed works
The common case:
Unlisted works
Are rendered inverted:
Artist screen
The About tab of the artist screen has a similar expandable artist bio, and had been patched with a one-off fix a couple of years ago. I also took this opportunity to standardize that on the
ReadMorecomponent.PR Checklist
To the reviewers 👀
Changelog updates
Changelog updates
Cross-platform user-facing changes
iOS user-facing changes
Android user-facing changes
Dev changes
Need help with something? Have a look at our docs, or get in touch with us.