Skip to content

strip embedded HTML from garden item summaries

jedmund requested to merge jedmund/strip-garden-blurb-html into main

Created by: jedmund

Summary

  • Garden detail pages were showing literal <br>, <br><br>, and <i>...</i> tags inside the summary blurb (most visible on AniList-imported manga like Fullmetal Alchemist) because the field was rendered as escaped text.
  • Adds a cleanSummary helper in src/lib/utils/content.ts that converts <br> to newlines, strips remaining tags, decodes the common HTML entities, and collapses extra whitespace.
  • Wires it into src/routes/garden/[category]/[slug]/+page.svelte via a $derived value. Existing markup and CSS (white-space: pre-line + -webkit-line-clamp: 3) are unchanged, so the "Read more" toggle still works and \n\n separators render as visible paragraph breaks.

No DB migration or import-side changes — render-time cleanup only.

Test plan

  • npm run dev, open the Fullmetal Alchemist garden item: no literal <br> / <i> visible; (Source: VIZ Media) and Note: ... blocks separated by blank lines; "Read more" expands/collapses.
  • Spot-check a non-manga item (movie/book) — plaintext summaries render unchanged.
  • npm run check and npm run lint pass.

Merge request reports

Loading