https://github.com/phothinmg/mm-mark
Convert Markdown to HTML
https://github.com/phothinmg/mm-mark
markdown mathjax-support prismjs showdown
Last synced: about 1 month ago
JSON representation
Convert Markdown to HTML
- Host: GitHub
- URL: https://github.com/phothinmg/mm-mark
- Owner: phothinmg
- License: apache-2.0
- Created: 2024-04-17T22:45:02.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-01T02:45:17.000Z (8 months ago)
- Last Synced: 2024-11-01T22:38:44.445Z (7 months ago)
- Topics: markdown, mathjax-support, prismjs, showdown
- Language: TypeScript
- Homepage:
- Size: 381 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# mm-mark
**_ESM Only_**

---
## Convert Markdown to HTML
Mmmark : Convert Md to Html with Showdown.Js.
> [!NOTE]
> This package focus on convert markdown to html . If you want more, recommended to use [Showdown.js](https://github.com/showdownjs/showdown)---
## Main dependencies bundled license information.
### 1. Showdown.js
Showdown.js is a powerful JavaScript library used for converting Markdown into HTML. It's a key dependency in our project, providing the core functionality of our Markdown to HTML conversion.
- Version: 2.1.0
- Release Date: 21-04-2022
- [Showdown.js GitHub](https://github.com/showdownjs/showdown)
- License: MIT### 2. JS-YAML
JS-YAML is a JavaScript implementation of YAML, a human-friendly data serialization standard. In our project, it's used for parsing YAML front matter in Markdown files.
- Version: 4.1.0
- [JS-YAML GitHub](https://github.com/nodeca/js-yaml)
- License: MIT### 3. Other dependencies
- Prism.Js for code block highlight.
- Mathjax for math support.
- tsup for typescript compile and bundle.---
[](https://badge.fury.io/js/mm-mark)
### Install from npm
```bash
npm i mm-mark
``````bash
yarn add mm-mark
``````bash
pnpm i mm-mark
```---
[](https://jsr.io/@ptm/mm-mark)
### Install from jsr.io
deno
```bash
deno add @ptm/mm-mark
```npm
```bash
npx jsr add @ptm/mm-mark
```yarn
```bash
yarn dlx jsr add @ptm/mm-mark
```pnpm
```bash
pnpm dlx jsr add @ptm/mm-mark
```bun
```bash
bunx jsr add @ptm/mm-mark
```**Import**
```ts
import * as mod from "@ptm/mm-mark";
```---
### Markdown to HTML.
```ts
import mmmark from "mm-mark";
const mdcontent = `
---
title: hello world
date: 2024-07-07
tags:
- foo
- bar
---## Hello
`;
const converter = mmmark.Converter(/*{Showdown Options} */);
// set flavor for this converter
converter.setFlavor("github");
const html = converter.makeHtml(mdcontent);
console.log(html); //Hello
```### Frontmatter
```ts
import mmmark from "mm-mark";
type MyType = {
type: string;
title: string;
};const mdcontent = `
---
title: hello world
date: 2024-07-07
tags:
- foo
- bar
---## Hello
`;
const foo = mmmark.frontmatter(mdcontent);
console.log(foo.data); // { title: 'hello world', date: 2024-07-07T00:00:00.000Z, tags: [ 'foo', 'bar' ] }
console.log(foo.content); // ## Hello
```### Extensions
**Available Extensions**
1. `icons`
```ts
import mmmark from "mm-mark";
import { customClass } from "mm-mark";const converter = mmmark.Converter({
extensions: [icons],
});const md = `@fa-home`;
const html = converter.makeHtml(md);
console.log(html); //
```2. `customClass`
```ts
import mmmark from "mm-mark";
import { customClass } from "mm-mark";const converter = mmmark.Converter({
noHeaderId: true, // recommended to set `true` for option `noHeaderId` when using customClass extension
extensions: [customClass],
});
const md = `#[.header]Header`;
const html = converter.makeHtml(md);
console.log(html); //Header
```You can use any `showdown` extensions.