Skip to content

Dedupe MarkdownFormatter into a shared package #990

@MaxGhenis

Description

@MaxGhenis

Context

The repo currently maintains two near-duplicate copies of MarkdownFormatter.tsx:

  • app/src/components/blog/MarkdownFormatter.tsx (Vite / legacy)
  • website/src/components/blog/MarkdownFormatter.tsx (Next.js)

Several recent bugs existed only in one copy:

A drift check (scripts/check-markdown-drift.ts) was added in the bug-audit batch to catch top-level API divergence, but the real fix is to extract the shared component into a package consumed by both sub-apps.

Plan

  1. Create a new workspace package (e.g. packages/blog) exporting MarkdownFormatter, HighlightedBlock, PlotlyChartCode, blog styles, useDisplayCategory, LazyPlot.
  2. Factor out sub-app-specific dependencies (e.g. OptimisedImage in app/) via a small props/context surface so the shared component is framework-agnostic.
  3. Replace both app/src/components/blog/MarkdownFormatter.tsx and website/src/components/blog/MarkdownFormatter.tsx with re-exports from the shared package.
  4. Delete scripts/check-markdown-drift.ts and its PR check once dedup is complete.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions