Skip to content

feat(markdown): Expose default components via Default prop#115745

Merged
natemoo-re merged 4 commits into
masterfrom
nm/markdown/expose-default
May 19, 2026
Merged

feat(markdown): Expose default components via Default prop#115745
natemoo-re merged 4 commits into
masterfrom
nm/markdown/expose-default

Conversation

@natemoo-re
Copy link
Copy Markdown
Member

Each MarkdownComponents override now receives a Default prop — a reference to the built-in component for that element. Consumers can conditionally customize rendering and fall through to the default without importing the internal defaultComponents module.

<Markdown
  raw={content}
  components={{
    Heading: ({children, level, Default}) => {
      if (level > 3) return <strong>{children}</strong>;
      return <Default level={level}>{children}</Default>;
    },
  }}
/>

Image is excluded since it has no built-in default. Two styled table cell components (DefaultTableHeaderCell, DefaultTableCell) need a cast due to native HTML align attribute narrowing.

@natemoo-re natemoo-re requested a review from a team as a code owner May 18, 2026 19:50
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.56%

Copy link
Copy Markdown
Member

@priscilawebdev priscilawebdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the null/undefined types that we still need to fix, this looks good to me. I'm new to this project, so it might be worth getting one more approval.

natemoo-re and others added 3 commits May 19, 2026 16:03
Each component override in `MarkdownComponents` now receives a
`Default` prop — a reference to the built-in component for that
element. This lets consumers conditionally customize rendering and
fall through to the default without importing internal modules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ltTableCell

Convert styled components to function component wrappers so their
types structurally match the `Default` prop's expected `ComponentType`,
eliminating two type coverage regressions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@natemoo-re natemoo-re force-pushed the nm/markdown/expose-default branch from 6a29e4f to c37608e Compare May 19, 2026 20:03
@natemoo-re natemoo-re enabled auto-merge (squash) May 19, 2026 20:03
@natemoo-re natemoo-re merged commit a3de4e2 into master May 19, 2026
70 checks passed
@natemoo-re natemoo-re deleted the nm/markdown/expose-default branch May 19, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants