unstale

npm / mdsvex

mdsvex

What changed in mdsvex 0.12 to 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

26 breaking1 security87 new APIs and options7 behavior and defaults4 tooling19 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

mdsvex 1143 changes

Breaking changes 26

  • Node append and prepend can create text nodes from a string; append('text') without text now throws a TypeError.

    1.0.0release notes

  • Character references in text, link and image attributes render as written rather than being escaped a second time; bare, escaped and code-contained ampersands remain escaped.

    1.0.0release notes

  • Annotations inside block comments hide the whole comment, and fences with many annotations render in linear time.

    1.0.0release notes

  • component_mode: 'all' now replaces typed HTML elements as well as elements produced by Markdown; elements with Svelte directives remain elements and cause a warning.

    1.0.0release notes

  • A directive can have only one owner; duplicate bindings now throw DirectiveOwnerError during setup instead of silently replacing the earlier owner.

    1.0.0release notes

  • Elements with duplicate attributes retain both during compilation, allowing Svelte to report attribute_duplicate instead of hiding the mistake.

    1.0.0release notes

  • Marks top-level brace groups in a code block as live Svelte expressions; it is enabled by default and included in default_annotations.

    1.0.0release notes

  • As a fence flag, applies [!eval] to every line of any fence, including fences without a language.

    1.0.0release notes

  • A footnote definition may put its text on the next line indented by four spaces; an empty definition now fails with FootnoteError code footnote_empty.

    1.0.0release notes

  • Heading IDs are generated as headings close, allowing parse plugins to read them in their heading handler; fixed IDs are preserved and collisions with earlier elements now raise HeadingIdError.

    1.0.0release notes

  • The editor accounts for the Vite plugin's import_images setting, enabled by default, so replaced img src values have the imported asset type rather than string.

    1.0.0release notes

  • Relative Markdown image URLs are imported relative to the document, allowing Vite to hash or inline them and fail the build when files are missing; aliases are imported as written.

    1.0.0release notes

  • HTML node attributes are now built lazily and are omitted from metadata spreads and key enumeration; read meta.attributes directly.

    1.0.0release notes

  • Code-fence open handlers receive the complete info string as node.info; node.lang retains the older name but now uses an empty string when absent.

    1.0.0release notes

  • Using a NodeView retained from a compiled document after the next document starts now errors, preventing access to that next document's nodes.

    1.0.0release notes

  • Renames the parsePlugins option to parse_plugins to follow mdsvex's snake_case option naming.

    1.0.0release notes

  • A replaced pre receives the whole pre element as children, plus code, language, metadata, title, caption, and unclaimed metadata parts as props.

    1.0.0release notes

  • Attribute values in raw HTML render as written, so entities such as & are not escaped a second time.

    1.0.0release notes

  • A run-marked code fence is displayed as code and imported as a module; a replacement pre component receives the module and decides how to run it.

    1.0.0release notes

  • In compile and compile_async, the callback receives the file path first, matching the Vite plugin; the path is the filename option or undefined.

    1.0.0release notes

  • Source mapping fields are getters, so spreading a mapping no longer copies offsets, lengths, or data; read those properties directly.

    1.0.0release notes

  • Static directives reject uses that cannot run in static output, snippets not rendered exactly once, head content, and indirect re-exports from the directives module.

    1.0.0release notes

  • List items beginning with a valid checkbox marker render a disabled checkbox; replaced li components receive a boolean checked prop instead.

    1.0.0release notes

  • Documents can be wrapped in named Svelte templates that receive frontmatter and document props plus the body as children; template selection and component replacement rules are added.

    1.0.0release notes

  • A container directive without a label contributes its text hook output in plain text before its body, so default titles appear in extracted text.

    1.0.0release notes

  • Vite 6 or later is required because Vite 5 does not call the hook needed to pick up changed component or template files in the dev server.

    1.0.0release notes

Security 1

  • Dev-server metadata requests now obey configured extensions and Vite server.fs allow, deny, and strict rules, like requests for the document itself.

    1.0.0release notes

New APIs and options 86

  • Directive child handlers can use a '*' key to handle every directly written child after its type-specific handler.

    1.0.0release notes

  • compile_async accepts an optional CompilerSession to retain plugin loads and allow hosts to invalidate paths and obtain fresh loads.

    1.0.0release notes

  • Reads files referenced by src= fences when supplied read and resolve options, and returns those files and the document template module in dependencies.

    1.0.0release notes

  • compile() accepts file contents through sources and throws a SourceError when a requested file is missing.

    1.0.0release notes

  • Compiles source to the same document text value provided by ?text, without Vite.

    1.0.0release notes

  • Invalidates cached plugin loads for the specified paths.

    1.0.0release notes

  • Hosts outside Vite can parse documents in steps, settle deferred work, and render after supplying needed inputs.

    1.0.0release notes

  • A components module can replace Markdown-produced elements with Svelte components exported under element names; only components used by a document are imported.

    1.0.0release notes

  • The highlight entry exports helpers for creating a highlighter, loading languages, and configuring annotations.

    1.0.0release notes

  • Adds values to an ordered plugin-data list; entries follow document order and are reverted when their node is revoked.

    1.0.0release notes

  • Shares a load between documents; path keys become dependencies and CompilerSession.invalidate(paths) drops cached values.

    1.0.0release notes

  • Exposes plugin data in compile results and warnings; writes are reverted when the parser revokes the node that made them.

    1.0.0release notes

  • Starts asynchronous work for a node that compile_async waits for; compile() throws PluginAsyncError if it is used.

    1.0.0release notes

  • Declares a file dependency for plugin output; compile results expose dependencies for host watching.

    1.0.0release notes

  • Gives parse plugin handlers the compile filename; it is undefined when none was supplied.

    1.0.0release notes

  • Provides parsed frontmatter to plugin handlers, parsing it on first access.

    1.0.0release notes

  • Allocates unique IDs across headings, footnotes, and plugin requests; fixed IDs preserve author-written values and can raise HeadingIdError on collision.

    1.0.0release notes

  • Reads a file through the read function supplied by the host.

    1.0.0release notes

  • Resolves a specifier through the resolve function supplied by the host.

    1.0.0release notes

  • Provides per-plugin, per-document scratch storage shared across handlers and hooks; it is not reverted and never reaches plugin_data.

    1.0.0release notes

  • Writes plugin data for a key; writes are associated with the handler's node and undone if that node is revoked.

    1.0.0release notes

  • Adds a warning to the compile, optionally located at a node.

    1.0.0release notes

  • Importing a document with ?data exports frontmatter metadata and plugin_data without its component, running plugins but rendering nothing.

    1.0.0release notes

  • A components module can declare directive components through a directives namespace export; unhandled directives are passed to parse-plugin handlers and otherwise fail compilation.

    1.0.0release notes

  • Node.svelte accepts directive components by name, with args as props and label and content as snippets.

    1.0.0release notes

  • A template can export its own directives namespace, which takes precedence over root directives for documents wrapped by that template.

    1.0.0release notes

  • Adds a plugin hook that runs after parsing, sequential passes, and deferred tasks, receiving the document root.

    1.0.0release notes

  • mdsvex/globals types the ?text import value as DocumentText.

    1.0.0release notes

  • Lets a plugin claim fence languages so the highlighter skips them and the plugin owns their rendering; duplicate claims throw FenceOwnerError.

    1.0.0release notes

  • Components modules can replace individual footnote references with a footnote export and the end section with a footnotes export.

    1.0.0release notes

  • Adds Markdown footnote references and definitions, numbered by first reference and collected at the end with backlinks; unresolved or duplicate labels error by default.

    1.0.0release notes

  • Frontmatter is parsed into metadata exported by compiled components and returned by compile(); a custom YAML parser can be supplied through frontmatter.parse.

    1.0.0release notes

  • The custom frontmatter parser receives the document path as its second argument in an object containing filename; the same parser is used for compiled documents, ?metadata imports, and ctx.frontmatter.

    1.0.0release notes

  • Enabling heading_ids adds GitHub-style text-based IDs to Markdown headings, with repeated IDs numbered; a slug function can customize the scheme.

    1.0.0release notes

  • mdsvex.config.json accepts highlight: false to disable editor code highlighting.

    1.0.0release notes

  • The Vite plugin highlights fenced code and code spans with twinkleplop by default; unknown languages render as plain twinkleplop markup with one warning per file.

    1.0.0release notes

  • compile() accepts a synchronous highlight function or false; it remains synchronous and does not highlight by default. A function may return HTML or null for plain code.

    1.0.0release notes

  • Disables Markdown image URL imports when set to false; it is enabled by default in the Vite plugin and off by default in compile().

    1.0.0release notes

  • When enhanced-img is installed and its Vite plugin is enabled, Markdown images can be imported as optimized pictures; the option can disable or require this behavior.

    1.0.0release notes

  • A code span wrapped in dollars renders as inline math through the same renderer as a math fence; plain dollar-delimited text remains text.

    1.0.0release notes

  • CursorHTMLRenderer and ComponentRenderer accept invalidate(buf, nodes) so nodes changed by deferred tasks rerender even inside cached blocks.

    1.0.0release notes

  • Sets a prefix for root URLs, using true for Vite's base, a string, or an imported function.

    1.0.0release notes

  • Names the directory whose document links can be rewritten into routes.

    1.0.0release notes

  • Selects a math renderer and its options; supports Temml by default, optional KaTeX, a custom renderer function, or false to leave math fences as code.

    1.0.0release notes

  • Adds a compiler-only entry point containing compile, CompilerSession, compiler errors, and option and result types without importing Vite, es-module-lexer, or Node builtins.

    1.0.0release notes

  • Provides TypeScript declarations for direct metadata imports when added to compilerOptions.types.

    1.0.0release notes

  • Adds a highlight entry point that exports language_loaders for loading bundled languages individually and re-exports shiki_notation.

    1.0.0release notes

  • Provides create_highlight and load_default_languages for building an asynchronous highlighter configuration for compile().

    1.0.0release notes

  • Adds a host entry for tools compiling documents without Vite, with exports for reading exports and serving metadata/data imports and editor manifests.

    1.0.0release notes

  • Adds exports for loading and using Temml, KaTeX, and source math renderers.

    1.0.0release notes

  • Components can read plugin data from Svelte context under this symbol as an object with a current property.

    1.0.0release notes

  • Imports a document's frontmatter without its component, exporting metadata as both a named and default export.

    1.0.0release notes

  • Indicates whether the parser may revoke a node; wrap_from and close are allowed only when the node is not pending.

    1.0.0release notes

  • Exposes a node's source offsets, line, and column; it may be undefined for plugin-created nodes and wire-format trees.

    1.0.0release notes

  • Removes a node and its descendants where the parser cannot revoke it; calls elsewhere throw.

    1.0.0release notes

  • Parse plugins can observe directives by name after owner handlers; observers can write plugin data and warn but cannot change nodes.

    1.0.0release notes

  • Reads the text value from a document compiled in steps.

    1.0.0release notes

  • Adds a new PFM parser and renderers.

    1.0.0release notes

  • Documents export plugin data beside metadata and pass the same object to the template; no export is added when plugins leave no data.

    1.0.0release notes

  • Adds a plugin system and an autolink plugin.

    1.0.0release notes

  • Adds a declaration-mergeable interface for plugins to type their own plugin_data keys.

    1.0.0release notes

  • Adds a type for the plugin data context obtained from Svelte context, typed by declared PluginData keys.

    1.0.0release notes

  • Notifies a listener of plugin-data writes and revocations, with the key's value after each change.

    1.0.0release notes

  • Accepts plugins that provide directives, directive handlers, parse plugins, and component replacements.

    1.0.0release notes

  • Adds a streaming renderer that applies batches, tracks plugin writes and deferred changes, and rerenders affected content through its lifecycle.

    1.0.0release notes

  • Finds the names exported by a module or Svelte module script, using a TypeScript stripper supplied by the host.

    1.0.0release notes

  • Reads an mdsvex.config.json file into the Vite plugin's manifest format and reports configuration problems, without requiring Vite or Node.

    1.0.0release notes

  • Accepts a function to rewrite links not handled by route or base rewriting.

    1.0.0release notes

  • With run=client, the component receives load, a function that imports the code block when requested, instead of module.

    1.0.0release notes

  • Allows choosing a document template from its id and metadata, as part of template selection.

    1.0.0release notes

  • Optionally converts prose quotes, dashes, and ellipses to typographic punctuation; it is off by default and leaves code and other excluded content unchanged.

    1.0.0release notes

  • compile() uses snippets to describe how running blocks are imported and can return their code; snippets: false only displays the block.

    1.0.0release notes

  • Code fences can show a file specified by src; paths resolve like document imports, optional line ranges select content, and development edits update pages that show the file.

    1.0.0release notes

  • Naming a directive component with .static.svelte renders it once at build time; its HTML is embedded without loading or hydrating the component in the browser.

    1.0.0release notes

  • Exposes plugin-written stream data as a new object after each change, so components reading it render again when it changes.

    1.0.0release notes

  • compile() accepts strict_directives: false to render an unhandled directive as its children instead of throwing, for previews and editors.

    1.0.0release notes

  • Tables support row-header columns and merged cells using || in the delimiter and header rows, and > or ^ cell markers.

    1.0.0release notes

  • An import query can override a document's template, including disabling it with ?template=false.

    1.0.0release notes

  • mdsvex/host exports template_module to combine a template and its extra replacements, with names from the extra module taking precedence.

    1.0.0release notes

  • A template can be an mdsvex document whose Markdown content reads props and renders children; a document used as a template is not wrapped in another template.

    1.0.0release notes

  • Sequential plugins may define a text handler to replace ranges in neighboring text runs with text or nodes; invalid handler configuration and overlapping replacements throw errors.

    1.0.0release notes

  • Builds the module for a document's extracted text.

    1.0.0release notes

  • Importing a document with ?text exposes reader-facing text by section without rendering its component, for uses such as search indexes and RSS bodies.

    1.0.0release notes

  • mdsvex exports the type of a text handler run for plugin authors.

    1.0.0release notes

  • When enabled, removes the paragraph wrapper around paragraphs containing only images, allowing block replacements such as figure; it is off by default.

    1.0.0release notes

  • When enabled, wraps runs of two or more top-level blocks without Svelte in display: contents divs to reduce initial hydration work; it is off by default and can affect selectors.

    1.0.0release notes

Behavior and default changes 7

  • Directive open handlers now receive the directive name immediately; block directive args are available there, while inline args remain available at close.

    1.0.0release notes

  • Directive labels accept inline Markdown; the label renders through the directive component's label snippet and is represented as a separate parse-tree node.

    1.0.0release notes

  • Footnote definitions can contain multiple blocks, with indented content continuing after a blank line and the first unindented nonblank line ending the definition.

    1.0.0release notes

  • Compiler sessions and the Vite plugin reuse their tree, dispatcher and renderer across documents when parse plugins are configured; a different array rebuilds them.

    1.0.0release notes

  • The footnotes strict: false setting turns missing-definition and duplicate-label errors into warnings for previews.

    1.0.0release notes

  • With SvelteKit 3, the mdsvex Vite plugin registers its extensions so they need not be repeated in sveltekit({ extensions }); without SvelteKit, missing Svelte extensions cause a build error.

    1.0.0release notes

  • Import statements at the top of a document are retained and placed in its instance script, creating a script when needed.

    1.0.0release notes

Tooling 4

  • The editor can read template, replacement-component, and directive information from the Vite-generated manifest or an mdsvex.config.json fallback, providing navigation, completions, and type checking.

    1.0.0release notes

  • The editor types document plugin_data exports and imports against PluginData when configured plugins may provide data; declared keys retain their types and other keys are unknown.

    1.0.0release notes

  • Vite build and development source maps point document code back to its lines in the .svx file.

    1.0.0release notes

  • mdsvex now ships declarations for compile, CompileOptions, mdsvex and other exports; @mdsvex/render types also check under TypeScript 6.

    1.0.0release notes

Fixes and other changes 19

  • The script started by bare imports uses lang="ts" when the import is a type import or the module script uses lang="ts".

    1.0.0release notes

  • Text appended inside a code fence created by a parse plugin now becomes its code in HTML, highlighting, pre replacements, and rendered blocks.

    1.0.0release notes

  • Fence titles, playground status and height are preserved whether or not code is highlighted; an unreplaced fence renders as plain pre/code without a figure.

    1.0.0release notes

  • Code spans and HTML comments created by parse plugins now render the text those plugins put in them.

    1.0.0release notes

  • After deferred tasks or async document hooks alter images or fences, settling rebuilds Parsed.needs, snippets and math from the settled tree so imports and file reads work.

    1.0.0release notes

  • Replacement exports are discovered when declared with multiple names or destructuring in one declaration.

    1.0.0release notes

  • Braces in code, fence info strings, and backslash-escaped Markdown text render as text instead of being interpreted by Svelte as expressions.

    1.0.0release notes

  • Opening and closing frontmatter fences now allow trailing spaces and tabs in compiled documents and ?metadata imports.

    1.0.0release notes

  • Windows and old Mac line endings compile to the same HTML as LF endings, and source maps point to the correct original lines and columns.

    1.0.0release notes

  • The first document that loads the math renderer is parsed only once, so parse plugins run once while the renderer loads.

    1.0.0release notes

  • Warnings from the first render of a document that loads the math renderer are no longer reported again on its second render.

    1.0.0release notes

  • Replacing or adding a plugin in an existing plugins array takes effect on the next compile.

    1.0.0release notes

  • Replaced pre components receive title, caption, and fence metadata props when highlighting is disabled or a highlighter returns null.

    1.0.0release notes

  • Documents imported with Vite's ?raw, ?url, ?worker or ?sharedworker queries are left to Vite instead of being compiled as Markdown.

    1.0.0release notes

  • Spread and attachment attributes in typed HTML are no longer rendered as invalid attribute assignments that Svelte cannot compile.

    1.0.0release notes

  • Style blocks in documents now work; the Vite plugin no longer compiles the style request as Markdown.

    1.0.0release notes

  • A top-level script with a src attribute renders as svelte:element, preventing embedded scripts from being treated as the component script.

    1.0.0release notes

  • TreeBuilder.reset() now works with plugins and resets its dispatcher.

    1.0.0release notes

  • Content is preserved as text through the closing tag, including indentation and line breaks; Markdown markers remain literal, while Svelte expressions and elements still work.

    1.0.0release notes

mdsvex 0.121 changes

New APIs and options 1

  • Adds an option to generate Svelte 5 runes-compatible layout prop forwarding.

    0.12.8release notes