`md-utils-ts` is a lightweight, TypeScript-first utility library designed for programmatic generation of common Markdown syntax elements. Currently at version 2.0.0, it provides a focused collection of functions to create bold text, italics, strikethroughs, underlines, anchor links, code blocks (inline and multi-line), equations, and headings (H1-H6). The library emphasizes simplicity and type safety, offering both individual named exports for each utility (e.g., `bold`, `h1`) and a bundled `md` object for convenience (e.g., `md.italic`). Unlike comprehensive Markdown parsers or renderers, `md-utils-ts` strictly focuses on outputting valid Markdown strings, making it ideal for scenarios where you need to construct Markdown content dynamically without heavy dependencies. Its release cadence is likely stable, with updates driven by new Markdown syntax needs or minor enhancements.
npm install md-utils-tsVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing both the default `md` object and named utility functions to create various Markdown elements like headings, bold text, links, code blocks, and equations.
For generating Markdown tables, integrate a dedicated library such as `markdown-table` from the `@wooorm` ecosystem, as `md-utils-ts` focuses on simpler, atomic Markdown elements.
For parsing or rendering Markdown, integrate with a dedicated Markdown parser/renderer library (e.g., `marked`, `remark`, `markdown-it`). `md-utils-ts`'s role is limited to constructing the Markdown string itself.
When using `code(inline)` or `equation(inline)`, remember to call it twice: first with the `inline` boolean, then with the content. For convenience, use `inlineCode`, `codeBlock`, `inlineEquation`, or `equationBlock` which are pre-configured versions.
Ensure named exports are correctly destructured: `import { bold } from 'md-utils-ts';`. If using CommonJS (not recommended for this ESM-first library), access named exports as properties: `const { bold } = require('md-utils-ts');`.Import the default export correctly: `import md from 'md-utils-ts';`.
Run `npm install md-utils-ts` or `yarn add md-utils-ts` to install the package. Double-check the spelling of the import path.
If you are using the `md` default import, access its properties correctly, e.g., `md.bold("text")`. If you prefer direct named imports, use `import { bold } from 'md-utils-ts'` and then `bold("text")`.No dependency data recorded yet.