markdown-exit icon indicating copy to clipboard operation
markdown-exit copied to clipboard

`Parser` from `markdown-exit/core` still bundles the renderer and presets

Open onmax opened this issue 4 weeks ago • 0 comments

Summary

A markdown-exit/parser entry that exports Parser without the renderer and presets.

Motivation

import { Parser } from 'markdown-exit/core' also bundles the renderer and presets, because tsdown emits core as one chunk. Comark only calls md.parse(), so it ships code it never runs.

Before is import { Parser } from 'markdown-exit/core', after is the same import from markdown-exit/parser.

before after change
minified 98.2 KiB 89.9 KiB -8.3 KiB
gzip 33.91 KiB 31.25 KiB -2.66 KiB

Proposed Solution

Add src/index.parser.ts, which re-exports ./parser and ./token, as a tsdown entry and a ./parser export. Its tokens match MarkdownExit().parse() on all 2,597 fixture blocks. Setting "sideEffects": ["./dist/index.js"] would shrink the core import to 31.3 KiB as well, but I haven't checked every module for side effects.

Would you take a PR? Related: markdown-it/markdown-it#924.

Would you like to work on this new feature?

  • [x] I'm interested in working on this new feature

onmax avatar Nov 05 '26 19:11 onmax