Skip to content

✨ Enhancement: Refactor StyledMarkdown.tsx for Modular Markdown Rendering #1659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
7 tasks
Tracked by #1654
idanidan29 opened this issue May 15, 2025 · 0 comments
Open
7 tasks
Tracked by #1654
Labels
✨ Enhancement Indicates that the issue suggests an improvement or new feature. Status: Triage This is the initial status for an issue that requires triage.

Comments

@idanidan29
Copy link
Contributor

idanidan29 commented May 15, 2025

Description

The StyledMarkdown component is the cornerstone for rendering all markdown content on the JSON Schema website. It converts markdown syntax into styled HTML, handles link transformation, tab group parsing, and generates a dynamic Table of Contents. Refactor it to improve maintainability, testability, and integrate ShadCN/UI primitives while preserving existing behaviors.


Tasks

1. Modularization

  • Extract Utilities:
    • Move link transformation logic into utils/transformLinks.ts
    • Move regex-based tab group parsing into utils/parseTabGroups.ts
  • Decompose Components:
    • Create <MarkdownBlock> to render standard markdown sections
    • Create <TabsGroup> to encapsulate tab parsing & switching
    • Create <TableOfContents> using React Context for navigable outlines

2. UI Library Integration

  • Headers & Text: Replace custom heading overrides with ShadCN’s <Heading> and <Typography>
  • Alerts & Callouts: Swap custom alert blocks for ShadCN’s <Alert> or <Callout>
  • Code Blocks: Render code fences with ShadCN’s <Code> component
  • Tables: Use ShadCN’s <Table> suite for all markdown tables
  • Tabs: Render dynamic tabs via ShadCN’s <Tabs> primitives within <TabsGroup>

Are you working on this?

Yes

@idanidan29 idanidan29 added ✨ Enhancement Indicates that the issue suggests an improvement or new feature. Status: Triage This is the initial status for an issue that requires triage. labels May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Enhancement Indicates that the issue suggests an improvement or new feature. Status: Triage This is the initial status for an issue that requires triage.
Projects
None yet
Development

No branches or pull requests

1 participant