JSPM

marked-katex-extension-ts

0.1.3
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 10
    • Score
      100M100P100Q49064F
    • License MIT

    typescript version marked-katex-extion

    Package Exports

    • marked-katex-extension-ts
    • marked-katex-extension-ts/lib/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (marked-katex-extension-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    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