Skip to content

Align solid-markdown with react-markdown 10.1.0 and add Solid-native async rendering#44

Draft
keithce wants to merge 1 commit intoandi23rosca:mainfrom
keithce:keithce/react-markdown-10-solid-port
Draft

Align solid-markdown with react-markdown 10.1.0 and add Solid-native async rendering#44
keithce wants to merge 1 commit intoandi23rosca:mainfrom
keithce:keithce/react-markdown-10-solid-port

Conversation

@keithce
Copy link

@keithce keithce commented Mar 7, 2026

Title

Align solid-markdown with react-markdown 10.1.0 and add Solid-native async rendering

Summary

This update moves solid-markdown from an older compatibility-focused API to an upstream-aligned react-markdown 10.1.0 style API, adapted for Solid. The rendering pipeline now follows the upstream remark -> rehype -> JSX runtime model, the public options match current upstream concepts, and async unified plugins are supported both on the server and on the client.

What changed

  • Replaced the custom renderer/filter pipeline with an upstream-style processor flow and hast-util-to-jsx-runtime.
  • Aligned the public API around Markdown, MarkdownAsync, MarkdownResource, remarkRehypeOptions, and urlTransform.
  • Simplified custom component typing so overrides receive normal Solid intrinsic props plus node.
  • Removed legacy wrapper-element behavior and made removed pre-v9 props fail explicitly at runtime instead of lingering as soft compatibility.
  • Added a Solid-native client async path through MarkdownResource.
  • Expanded SSR and client coverage to include rendering parity, URL safety, removed-prop runtime errors, plugin/property passthrough, and async lifecycle behavior.

Why this is valuable

  • It makes the package easier to understand for anyone already using modern react-markdown.
  • It removes older behavior that was diverging from upstream semantics and complicating maintenance.
  • It gives Solid users a clear story for async plugins on both the server and the client.
  • It tightens the package surface area and types instead of preserving multiple generations of API compatibility.
  • It raises confidence in the port with a much broader regression suite across SSR and browser rendering.

Compatibility and migration

This change is intentionally breaking in the same places where upstream has already moved on:

  • SolidMarkdown is removed in favor of the default Markdown export.
  • Wrapper props such as class/className are removed; callers should wrap the component themselves.
  • Legacy props such as source, plugins, renderers, allowNode, allowedTypes, disallowedTypes, transformLinkUri, and transformImageUri now throw.
  • urlTransform replaces the older link/image transform props.
  • renderingStrategy remains temporarily for the sync component only, but it is deprecated and intended for removal in the next major release.

Verification

Verified locally with:

pnpm lint
pnpm test
pnpm build

Current test coverage includes:

  • SSR rendering coverage
  • Browser rendering coverage
  • URL sanitization and transform behavior
  • Removed-prop runtime error coverage
  • Async plugin behavior for both MarkdownAsync and MarkdownResource

Notes for review

  • The goal here is not to preserve every historical solid-markdown API quirk. The goal is to make this package a clean Solid port of modern react-markdown.
  • The only intentional short-term compatibility holdout is the deprecated renderingStrategy prop on Markdown.
  • The README and demo docs were updated to describe the new API and the current verification story so users do not have to infer behavior from source alone.

@andi23rosca
Copy link
Owner

Thanks for this!

I'll have to play around with it and test it but I agree with the overall changes 👍🏻

@andi23rosca
Copy link
Owner

@keithce we should probably bump the version to 3.0.0 in the package.json since there's so many breaking changes in the API

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