{"_id":"@abhi1264/fastmd","_rev":"3-7d16c398f3304fae6efccae9c506d4bc","name":"@abhi1264/fastmd","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@abhi1264/fastmd","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"@abhi1264/fastmd@1.0.0","maintainers":[{"name":"abhi1264","email":"abhinav.kumar.1264@gmail.com"}],"dist":{"shasum":"988f7e657bf1acbb6dce52b060b19fa39afbc664","tarball":"https://registry.npmjs.org/@abhi1264/fastmd/-/fastmd-1.0.0.tgz","fileCount":25,"integrity":"sha512-IfqlGUhQqrU1C6A5M5y6wZr+BG+TB4Hlc0BwhFufsNkEzEbiLemIDhb2zUlARVqfWp/ccNmzGaAXxAays09l9w==","signatures":[{"sig":"MEUCIQDvkChvAuEdHBU7yKmdTdP1U+R/Ptxvf3oNXA+rEKUs6AIgGz98dtJwVAXbZOjk5GPkAjlR81HES6Sk4f3h16b1Y3A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44056},"main":"dist/index.node.js","type":"module","types":"./dist/index.node.d.ts","module":"dist/index.js","browser":"dist/index.js","exports":{".":{"node":"./dist/index.node.js","import":"./dist/index.js","default":"./dist/index.node.js"},"./react":"./dist/render/react.js"},"gitHead":"d23681fa0129e6d1add47809940a7e647feee987","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc -p ../../crates/fastmd-core/tsconfig.json && (cp -r ../../crates/fastmd-core/src/wasm dist/ 2>/dev/null || true) && (cp -r ../../crates/fastmd-core/src/pkg-node dist/ 2>/dev/null || true)"},"_npmUser":{"name":"abhi1264","email":"abhinav.kumar.1264@gmail.com"},"_npmVersion":"11.6.4","description":"High-performance markdown parser for Node.js and the browser","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"packageManager":"pnpm@10.28.1","devDependencies":{"typescript":"^5.9.3"},"peerDependencies":{"react":">=17.0.0"},"peerDependenciesMeta":{"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/fastmd_1.0.0_1770028029067_0.18999788437741127","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@abhi1264/fastmd","version":"1.0.1","keywords":[],"author":"","license":"ISC","_id":"@abhi1264/fastmd@1.0.1","maintainers":[{"name":"abhi1264","email":"abhinav.kumar.1264@gmail.com"}],"dist":{"shasum":"77ad631ff312db3a31ad869ad1f53828cc18a7b1","tarball":"https://registry.npmjs.org/@abhi1264/fastmd/-/fastmd-1.0.1.tgz","fileCount":26,"integrity":"sha512-kekcVj2d35X8t7CHxoRZzkK0i5VeRaz0EaHexPXh7CoobNTwOih3kdnz5wv/GOO0+FK16ZcbWyQSxYZZkVbc8Q==","signatures":[{"sig":"MEQCIEF3UtvgI4EtZwB20D924KYM0Vm+ruY0FheWRGOVmqc5AiAOnv/MQPsREMC9lNlN9XrV2XHtfJuDMA7b7d6w48ICiw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47036},"main":"dist/index.node.js","type":"module","types":"./dist/index.node.d.ts","module":"dist/index.js","browser":"dist/index.js","exports":{".":{"node":"./dist/index.node.js","import":"./dist/index.js","default":"./dist/index.node.js"},"./react":"./dist/render/react.js"},"gitHead":"92a6ac8c06af0a37d2d170460347f2a3f5b7a09c","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc -p ../../crates/fastmd-core/tsconfig.json && (cp -r ../../crates/fastmd-core/src/wasm dist/ 2>/dev/null || true) && (cp -r ../../crates/fastmd-core/src/pkg-node dist/ 2>/dev/null || true)"},"_npmUser":{"name":"abhi1264","email":"abhinav.kumar.1264@gmail.com"},"_npmVersion":"11.6.4","description":"High-performance markdown parser for Node.js and the browser","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"packageManager":"pnpm@10.28.1","devDependencies":{"typescript":"^5.9.3"},"peerDependencies":{"react":">=17.0.0"},"peerDependenciesMeta":{"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/fastmd_1.0.1_1770028210223_0.7447271248390093","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@abhi1264/fastmd","version":"1.0.2","description":"High-performance markdown parser for Node.js and the browser","type":"module","main":"dist/index.node.js","module":"dist/index.js","browser":"dist/index.js","exports":{".":{"node":"./dist/index.node.js","import":"./dist/index.js","default":"./dist/index.node.js"},"./react":"./dist/render/react.js"},"peerDependencies":{"react":">=17.0.0"},"peerDependenciesMeta":{"react":{"optional":true}},"scripts":{"build":"tsc -p ../../crates/fastmd-core/tsconfig.json && (cp -r ../../crates/fastmd-core/src/wasm dist/ 2>/dev/null || true) && (cp -r ../../crates/fastmd-core/src/pkg-node dist/ 2>/dev/null || true)","test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"","license":"ISC","packageManager":"pnpm@10.28.1","devDependencies":{"typescript":"^5.9.3"},"gitHead":"c1b0cfffcf743394bbe04cfe3dca1b3de45fd741","types":"./dist/index.node.d.ts","_id":"@abhi1264/fastmd@1.0.2","_nodeVersion":"22.19.0","_npmVersion":"11.6.4","dist":{"integrity":"sha512-wYFCVxFNADzH8OP7U2kjqzKiug+pgLaeyPvcGJB6WUuY2OARg9GS9zA9vHysgohq2q4X7kCX/mvA/rISyNiEJg==","shasum":"a3ff5916b26949adaca8fc87704246c2f1555208","tarball":"https://registry.npmjs.org/@abhi1264/fastmd/-/fastmd-1.0.2.tgz","fileCount":26,"unpackedSize":47066,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHNsDOTI9yGYUSEGhZcXWu+rgmVSzVmKOeWtQrubI7YhAiBhBvWmze5jUJKvHeIBDCSJAhd80pIPwLUNH5XQu8KQLg=="}]},"_npmUser":{"name":"abhi1264","email":"abhinav.kumar.1264@gmail.com"},"directories":{},"maintainers":[{"name":"abhi1264","email":"abhinav.kumar.1264@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fastmd_1.0.2_1770029712228_0.10959676896563053"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-02T10:27:08.933Z","modified":"2026-02-02T10:55:12.518Z","1.0.0":"2026-02-02T10:27:09.198Z","1.0.1":"2026-02-02T10:30:10.356Z","1.0.2":"2026-02-02T10:55:12.384Z"},"license":"ISC","keywords":[],"description":"High-performance markdown parser for Node.js and the browser","maintainers":[{"name":"abhi1264","email":"abhinav.kumar.1264@gmail.com"}],"readme":"# fastmd\n\nHigh-performance markdown parser for Node.js and the browser (Rust/WASM core).\n\n## Build\n\n```bash\npnpm install\npnpm build:wasm   # build WASM (web + Node)\npnpm build       # compile TS and copy WASM into packages/fastmd/dist\n```\n\n## Test\n\n```bash\npnpm test        # unit tests; integration tests run when WASM is built\n```\n\n## Benchmark\n\n**fastmd only:**\n\n```bash\npnpm build:wasm:node\npnpm bench\n```\n\n**Compare vs react-markdown and Bun’s native markdown:**\n\n1. Build WASM: `pnpm build:wasm:node`\n2. Optional: install react-markdown for comparison:\n   ```bash\n   pnpm add -D react-markdown react react-dom\n   ```\n3. Run comparison (Node):\n   ```bash\n   pnpm bench:compare\n   ```\n4. Or run under **Bun** (uses Bun’s runtime; Bun’s native markdown is included if your Bun version exposes it):\n   ```bash\n   bun run crates/fastmd-core/bench/compare.bench.ts\n   ```\n\nSame fixture and iteration count for all parsers; output is ops/sec so you can compare.\n\n## Usage\n\n**Node.js** (sync, no init):\n\n```js\nimport { parseToTokens, renderHTML } from \"@abhi1264/fastmd\"\nconst tokens = parseToTokens(\"# Hello\\n\")\nconsole.log(renderHTML(tokens, \"# Hello\\n\"))  // <h1>Hello</h1>\n```\n\n**Browser** (async init once):\n\n```js\nimport initfastmd, { parseToTokens } from \"@abhi1264/fastmd\"\nawait initfastmd()\nconst tokens = parseToTokens(\"# Hello\\n\")\n```\n\nSee [docs/INIT.md](docs/INIT.md) and [docs/STREAMING.md](docs/STREAMING.md).\n\n## Supported syntax\n\n| Feature | Supported |\n|--------|-----------|\n| Headings (`#`–`######`) | ✅ |\n| **Bold** (`**` / `__`) | ✅ |\n| *Italic* (`*` / `_`) | ✅ |\n| ~~Strikethrough~~ (`~~`) | ✅ |\n| `Code` inline | ✅ |\n| Fenced code blocks (`` ``` ``) with optional language | ✅ |\n| [Links](url) | ✅ |\n| Autolinks `<https://…>` | ✅ |\n| Blockquotes (`>`) | ✅ |\n| Unordered lists (`-` / `*` / `+`) | ✅ |\n| Ordered lists (`1.` …) | ✅ |\n| Horizontal rule (`---` / `***`) | ✅ |\n\n**Not supported:** raw HTML, tables, task lists, definition lists, footnotes, front matter. Use a full CommonMark/GFM parser if you need those.\n\n## Render options\n\n`renderHTML(tokens, src, options)` accepts:\n\n- `linkTarget` – e.g. `\"_blank\"` for links\n- `headingIdPrefix` – prefix for heading `id` (slug from text)\n- `codeClassPrefix` – prefix for code block class (e.g. `\"language-\"` for syntax highlighting)\n\n## React components (optional)\n\nFor custom React components per element (like react-markdown):\n\n```js\nimport { parseToTokens, renderToReact } from \"@abhi1264/fastmd/react\"\nconst tokens = parseToTokens(\"# Hi\\n\")\nconst nodes = renderToReact(tokens, \"# Hi\\n\", {\n  a: (props) => <a {...props} target=\"_blank\" />,\n})\n```\n\nRequires `react` as peer. Import from `fastmd/react`.\n\n## Token format\n\nParse returns a flat `Uint32Array`: 4 u32 per token `[kind, start, end, aux]`. Use `tokensFromBuffer(buf)` to get `Token[]`, or `parseToTokens(md)` for the full string → tokens pipeline. `start`/`end` are UTF-16 code unit offsets for correct `src.slice(start, end)` in JS.\n","readmeFilename":"README.md"}