# markdown-to-html
**Repository Path**: mirrors_jaywcjlove/markdown-to-html
## Basic Information
- **Project Name**: markdown-to-html
- **Description**: Converts markdown text to HTML.
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2022-03-14
- **Last Updated**: 2025-09-21
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
Convert Markdown to HTML.
===
[](https://jaywcjlove.github.io/#/sponsor)
[](https://github.com/jaywcjlove/markdown-to-html/actions/workflows/ci.yml)
[](https://www.jsdelivr.com/package/npm/@wcj/markdown-to-html)
[](https://www.npmjs.com/package/@wcj/markdown-to-html)
[](https://uiwjs.github.io/npm-unpkg/#/pkg/@wcj/markdown-to-html/file/README.md)
Converts markdown text to HTML.
## Installation
This package v2+ is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): Node 12+ is needed to use it and it must be import instead of require.
```bash
$ npm i @wcj/markdown-to-html
```
## Usage
```js
import markdown, { getCodeString } from '@wcj/markdown-to-html';
markdown('# Markdown String')
// =>
Markdown String
```
Or manually download and link `markdown-to-html` in your HTML, It can also be downloaded via [UNPKG](https://unpkg.com/browse/@wcj/markdown-to-html/):
CDN: [UNPKG](https://unpkg.com/@wcj/markdown-to-html/dist/) | [jsDelivr](https://cdn.jsdelivr.net/npm/@wcj/markdown-to-html/) | [Githack](https://raw.githack.com/jaywcjlove/markdown-to-html/gh-pages/markdown.min.js) | [Statically](https://cdn.statically.io/gh/jaywcjlove/markdown-to-html/gh-pages/markdown.min.js)
```html
```
## Add Markdown Style
① Import the css file.
```html
```
② Or use [``](https://jaywcjlove.github.io/markdown-style) components.
[](https://www.npmjs.com/package/@wcj/markdown-style)
[](https://github.com/jaywcjlove/markdown-style)
```html
Markdown HTML
```
## API
```ts
import { PluggableList } from 'unified';
import { Options as RemarkRehypeOptions } from 'remark-rehype';
import { RehypeRewriteOptions, getCodeString } from 'rehype-rewrite';
export { getCodeString };
export interface Options {
/** [remark-rehype](https://github.com/remarkjs/remark-rehype) options */
remarkRehypeOptions?: RemarkRehypeOptions;
/** List of [remark plugins](https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins) to use. See the next section for examples on how to pass options */
remarkPlugins?: PluggableList;
/** List of [rehype plugins](https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins) to use. See the next section for examples on how to pass options */
rehypePlugins?: PluggableList;
/** Used to filter default plugins */
filterPlugins?: (type: 'remark' | 'rehype', plugins?: PluggableList) => PluggableList;
/** Resulting Node tree. */
hastNode?: boolean;
/** Rewrite Element. [rehype-rewrite](https://github.com/jaywcjlove/rehype-rewrite#rewritenode-index-parent-void) */
rewrite?: RehypeRewriteOptions['rewrite'];
/** See KaTeX [options](https://katex.org/docs/options.html). */
katexOptions?: KatexOptions;
}
export default function markdown(markdownStr?: string, options?: Options): string | import("hast").Root;
```
## Markdown Features
### Supports for CSS Style
Use HTML comments [``](https://github.com/jaywcjlove/rehype-attr) to let Markdown support style customization.
```markdown
## Title
Markdown Supports **Style**
```
### Support for [GFM footnotes](https://github.blog/changelog/2021-09-30-footnotes-now-supported-in-markdown-fields/)
```markdown
Here is a simple footnote[^1]. With some additional text after it.
[^1]: My reference.
```
### Support for [KaTeX](https://github.com/Khan/KaTeX)
Support markdown syntax to render math. You can combine it with [KaTeX](https://github.com/Khan/KaTeX) in markdown, add \`KaTeX:string\` and \`\`\`markdown classes in markdown.
```markdown
\`KaTeX:c = \\pm\\sqrt{a^2 + b^2}\`
```
```markdown
\`\`\`KaTeX
c = \\pm\\sqrt{a^2 + b^2}
L = \\frac{1}{2} \\rho v^2 S C_L
\`\`\`
```
## Related
- [markdown-to-html-cli](https://github.com/jaywcjlove/markdown-to-html-cli) Converts markdown text to HTML, Provide command line tools and methods.
## Contributors
As always, thanks to our amazing contributors!
Made with [github-action-contributors](https://github.com/jaywcjlove/github-action-contributors).
## License
Licensed under the [MIT License](https://opensource.org/licenses/MIT).