Skip to content

0.8.0

Latest

Choose a tag to compare

@lxsmnsyc lxsmnsyc released this 02 Sep 08:39
24b790a

Highlights

This release rebuilds how solid-marked is packaged, adds the missing HTML builtin, and fixes two bugs that made the published packages hard to consume.

Important

solid-marked, unplugin-solid-marked and vite-plugin-solid-marked are now ESM-only, and require Node ^20.19.0 || >=22.12.0. See Breaking changes below.

Breaking changes

ESM-only

The CommonJS builds never worked. require('solid-marked/compiler') threw github_slugger.default is not a constructor, and require('unplugin-solid-marked').default was undefined. The whole dependency graph — github-slugger, mdast-util-*, micromark-* — is ESM-only, and the CommonJS bundle wrapped those ESM namespaces a second time when interoperating with them.

Rather than keep an entry point that crashes on import, the require conditions and *.cjs files are gone. Every supported bundler already resolves the import condition, and Node 20.19+/22.12+ can require() these packages through require(esm).

engines.node is now ^20.19.0 || >=22.12.0

It previously claimed >=10, which predated the ESM-only dependency graph by years. It now states the range the toolchain actually needs, and the one where require(esm) is available.

Export conditions

The development and production export conditions have been dropped — no code branched on them. The build now emits dist/<entry>.js plus its declaration file.

New

The HTML builtin

MDXBuiltinComponents declares an HTML component, and the runtime <Markdown> component renders html nodes through it instead of throwing invalid node. The compiler handles html nodes at the document root too.

Raw HTML is handed to your component as a string — it is never injected into the page, so escaping or rendering it stays your decision.

<Markdown
  builtins={{
    HTML: props => <div innerHTML={props.children ?? ''} />,
  }}
>
  {source}
</Markdown>

Prop types re-exported from the package root

MDXBuiltinComponents, MDXProps and the per-node prop types no longer have to be imported from solid-marked/compiler:

import type { HeadingProps, MDXBuiltinComponents } from 'solid-marked';

solid-marked/env export

"types": ["solid-marked/env"] now resolves through the exports map.

Fixes

Markdown imports type-check again

src/global-types.d.ts had a top-level import, which made TypeScript treat its declare module '*.md' blocks as module augmentations rather than ambient wildcard modules. Importing a markdown file in a consumer project failed with Cannot find module './Doc.md'. The declarations no longer import anything at the top level.

noDynamicComponents accepts 'only-mdx' in the plugins

SolidMarkedPluginOptions.noDynamicComponents was typed boolean, even though the value is passed straight to a compiler that also accepts 'only-mdx'. It is now typed boolean | 'only-mdx'.

Tooling

  • Builds moved from pridepack to tsdown, with publint running on every build.
  • Linting and formatting moved from Biome to oxlint (type-aware, via @lxsmnsyc/oxlint-config) and oxfmt.
  • unplugin-solid-marked moves to unplugin v3 — the deprecated loadInclude hooks are replaced by the load.filter API, and handleHotUpdate by hotUpdate. Vite 8 is now supported alongside Vite 7.
  • Tests grew from 81 to 124, adding runtime-renderer coverage, compiler options, frontmatter, source maps, and real vite.build integration tests for the plugin.
  • Dependencies updated: solid-js 1.9.15, vitest 4.1, source-map 0.8, toml 5, yaml 2.9, seroval 1.6.

Docs

The README has been restructured around a working quick start, a compile API reference with an options table, and a table of all 24 builtins with their mdast node and props. Every exported symbol now carries JSDoc, and both demos in examples/ were modernised.

Install

npm i solid-js solid-marked
npm i -D vite-plugin-solid-marked vite-plugin-solid

Full changelog: https://github.com/lxsmnsyc/solid-marked/compare/solid-marked@0.7.0...solid-marked@0.8.0