Skip to content

fix(web): clean up markdown output for cards, logos and UI affordances#39

Merged
jhb-dev merged 1 commit into
mainfrom
claude/de-markdown-bugs-7y8k0h
Jun 27, 2026
Merged

fix(web): clean up markdown output for cards, logos and UI affordances#39
jhb-dev merged 1 commit into
mainfrom
claude/de-markdown-bugs-7y8k0h

Conversation

@jhb-dev

@jhb-dev jhb-dev commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Enhances the HTML-to-Markdown converter to properly handle card components (services, projects, articles) that wrap block-level content in anchor tags, and excludes UI-only elements from the Markdown output.

Changes

  • Added blockLink rule to Turndown: Detects anchors wrapping block-level content (headings, paragraphs, divs, lists) and converts them intelligently by linking the first heading while preserving remaining content as normal blocks. Falls back to linking collapsed text if no heading is present.
  • Strip excluded elements: Removes elements marked with .md-exclude class or aria-hidden="true" attribute before conversion, preventing UI-only affordances (buttons, decorative icons, duplicate content) from appearing in Markdown.
  • Updated TestimonialsBlock: Added md-exclude class to the "see more" fade overlay button to prevent it from being included in the Markdown representation.

Implementation Details

The blockLink rule uses a regex to detect and rewrite Markdown headings with inline links, preserving the heading structure while applying the link to the heading text only. This prevents malformed Markdown output that would occur with Turndown's default link handling for block-wrapping anchors.

https://claude.ai/code/session_01CmWTCNSATpSf21dgP5ZV8g

The HTML→Markdown integration produced three artefacts on pages like /de.md:

1. Card components (services/projects/articles) wrap a heading + description
   in a single <a>. Turndown's link rule only handles inline content, so it
   emitted a stray "[" before the block and a dangling "](href)" after it.
   Add a `blockLink` Turndown rule that links the card's first heading instead.

2. The customer logo marquee and the schematic service visuals duplicated
   content (aria-hidden marquee copies, decorative SVGs, eyebrow glyphs),
   which showed up doubled / as junk in Markdown. Strip `[aria-hidden="true"]`
   before conversion — decorative content hidden from assistive tech should be
   hidden from Markdown too.

3. Add a generic `.md-exclude` opt-out class for UI-only affordances and apply
   it to the testimonials "show more" button.

Verified by running the conversion pipeline against the live /de HTML.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmWTCNSATpSf21dgP5ZV8g
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
website Ready Ready Preview, Comment Jun 27, 2026 3:14pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
website-cms Ignored Ignored Jun 27, 2026 3:14pm

Request Review

@jhb-dev jhb-dev changed the title Improve HTML-to-Markdown conversion for card components fix(web): clean up markdown output for cards, logos and UI affordances Jun 27, 2026
@github-actions

Copy link
Copy Markdown

Preview Deployment

Project URL
CMS https://website-6lqp3u52w-jhb-software.vercel.app
Web https://website-fegg6xjp2-jhb-software.vercel.app

The Web preview uses the CMS preview URL for content fetching.

@jhb-dev
jhb-dev merged commit 4d63c5c into main Jun 27, 2026
16 of 17 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.

2 participants