Registry / devops / solid-marked

solid-marked

JSON →
library0.7.0jsnpmunverified

MDX/Markdown compiler for SolidJS. Version 0.7.0, peer dependency on solid-js ^1.7. Compiles Markdown to SolidJS components at build time via Vite/unplugin. Supports all mdast nodes (Paragraph, Heading, ThematicBreak, etc.) with built-in components configurable through an MDX provider pattern. Requires the compile() function to generate code, and runtime relies on Dynamic component for dynamic rendering. Differentiated from generic Markdown compilers by tight SolidJS integration, TypeScript types, and lightweight runtime.

npm install solid-marked
INSTALL
IMPORT
SIG · SOLID-MARKED
S
solid-marked
devopsjavascriptv0.7.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

compile
import { compile } from 'solid-marked/compiler'
import { compile } from 'solid-marked'
compile is only exported from the subpath 'solid-marked/compiler', not the main package.
MDXProvider
import { MDXProvider } from 'solid-marked'
import { MDXProvider } from 'solid-marked/provider'
MDXProvider is exported from the main entry point.
useMDX
import { useMDX } from 'solid-marked'
import { useMDX } from 'solid-marked/compiler'
Use the hook from the main package, not the compiler subpath.

Shows Vite plugin setup, MDXProvider wrapping, and using useMDX hook to provide built-in components.

// Install: npm i solid-js solid-marked // Vite example (vite.config.js) import { defineConfig } from 'vite'; import solidPlugin from 'vite-plugin-solid'; import solidMarked from 'solid-marked/vite'; export default defineConfig({ plugins: [ solidPlugin(), solidMarked() ] }); // In your Solid component: import { MDXProvider, useMDX } from 'solid-marked'; import MyMarkdown from './my-markdown.md'; // after preprocessing function App() { const mdx = useMDX(); return ( <MDXProvider builtins={{ ...mdx.builtins }}> <MyMarkdown /> </MDXProvider> ); }
Debug
Known issues
gotchaThe compile() function is only available from the subpath 'solid-marked/compiler', not from the main package. Importing from main will give undefined.
fix
Use import { compile } from 'solid-marked/compiler'
affects: >=0.1
deprecatedPeer dependency requires solid-js ^1.7. If you use solid-js v2 (future), this package may not work until updated.
fix
Check updates for solid-marked compat with solid-js v2.
affects: >=0.7
gotchaMDXProvider and useMDX must be used together. Forgetting to wrap with MDXProvider will cause runtime errors as builtins won't be available.
fix
Wrap your app with <MDXProvider builtins={...}> and use useMDX inside children.
affects: >=0.1
gotchaThe compiled output uses SolidJS Dynamic component. If you set noDynamicComponents to true, ensure you provide all needed builtins statically.
fix
Set noDynamicComponents: false (default) or provide your own implementation.
affects: >=0.1
Errors
Common errors & fixes
Uncaught TypeError: Cannot read properties of undefined (reading 'Root')
Missing MDXProvider wrapper so useMDX returns undefined for builtins.
fix
Wrap your component tree with <MDXProvider builtins={{ Root, Paragraph, ... }}> and use useMDX inside.
Error: @solidjs/router: A <Routes> can only be used inside a <Router> component.
Confusion with solid-app-router; not directly related to solid-marked, but may appear if using router and missing provider.
fix
Ensure you have <Router> wrapped appropriately.
SyntaxError: The requested module 'solid-marked' does not provide an export named 'compile'
Importing compile from main entry instead of subpath.
fix
Change import to 'solid-marked/compiler'
Upgrade
Version history
0.7.0latest on npm
Audit
Dependencies
solid-jsrequiredPeer dependency required to use generated components and compile-time JSX
Agent activity
7 hits · last 30 days
node
6
Resources
solid-marked — npm install solid-marked · libregistry