Skip to content

ceigh/markdown-it-typograf

Repository files navigation

📃 markdown-it-typograf

Tiny markdown-it plugin, with typograf integration.

Check demo.

Setup

npm install markdown-it-typograf

Usage

import markdownit from "markdown-it";
import markdownitTypograf from "markdown-it-typograf";

const md = markdownit().use(markdownitTypograf, {
  // ...options
});
console.log(md.render('"Привет"')); // <p>«Привет»</p>\n

Options

Option Default Description
typografOptions { locale: 'ru' } Options passed to typograf.
typografSetup undefined Function to customize typograf programmatically.

Example

const md = markdownit().use(markdownitTypograf, {
  typografOptions: {
    locale: "ru",
    disableRule: "*",
  },
  typografSetup(tp) {
    tp.enableRule("common/number/mathSigns");
  },
});
console.log(md.render("0 != 1")); // <p>0 ≠ 1</p>\n

Development

bun install
bunx simple-git-hooks
bun run dev