Skip to content

Znak

Znak is a parser for a Markdown-like markup language that supports a smaller subset of Markdown syntax, and is stricter and more opinionated. It has features like syntax highlighting, LaTeX, and heading IDs built-in.

The name "Znak" comes from the Polish word "znak", meaning "sign" or "mark".

Usage

  1. Install the package as a dependency to your project.

    sh
    bun add @noclaps/znak
  2. Import the package in your code, and use it.

    ts
    import { render, headings } from "@noclaps/znak";
    
    const text = "# Hello World"; // Your text to be rendered.
    const renderedHTML = render(text);
    // <h1 id="hello-world">Hello World</h1>
    const headings = headings(text);
    // [{depth: 1, slug: "hello-world", title: "Hello World"}]

See the Types documentation for all of the configuration options and types, and the Syntax documentation for the supported syntax.

Released under the 0BSD license.