Align solid-markdown with react-markdown 10.1.0 and add Solid-native async rendering
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, andurlTransform. - 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:
SolidMarkdownis removed in favor of the defaultMarkdownexport.- Wrapper props such as
class/classNameare removed; callers should wrap the component themselves. - Legacy props such as
source,plugins,renderers,allowNode,allowedTypes,disallowedTypes,transformLinkUri, andtransformImageUrinow throw. urlTransformreplaces the older link/image transform props.renderingStrategyremains 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
MarkdownAsyncandMarkdownResource
Notes for review
- The goal here is not to preserve every historical
solid-markdownAPI quirk. The goal is to make this package a clean Solid port of modernreact-markdown. - The only intentional short-term compatibility holdout is the deprecated
renderingStrategyprop onMarkdown. - 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.
Thanks for this!
I'll have to play around with it and test it but I agree with the overall changes 👍🏻
@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