0.1.3 • Published 2 years ago

marked-katex-extension-ts v0.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

marked-katex-extension-ts

This project is typescript rewrite to marked-katex-extension.

Render katex code in marked

Note: Block level katex requires at least 2 $ at the beginning and end.

This is inline katex: $c = \\pm\\sqrt{a^2 + b^2}$

This is block level katex:

$$
c = \\pm\\sqrt{a^2 + b^2}
$$

You will still need to include the css in your html document to allow katex styles.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.css" integrity="sha384-bYdxxUwYipFNohQlHt0bjN/LCpueqWz13HufFEV1SUatKs1cm4L6fFgCi1jT643X" crossorigin="anonymous">

Usage

const {marked} = require("marked");
const markedKatex = require("marked-katex-extension");

// or ES Module script
// import marked from "https://cdn.jsdelivr.net/gh/markedjs/marked/lib/marked.esm.js";
// import markedKatex from "https://cdn.jsdelivr.net/gh/UziTech/marked-katex-extension/lib/index.mjs";

const options = {
  throwOnError: false
};

marked.use(markedKatex(options));

marked("katex: $c = \\pm\\sqrt{a^2 + b^2}$");

image

options

Options are sent directly to katex.renderToString

0.1.3

2 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago