Markdown Stream Parser by NLUX 🌲✨💬
A lightweight JS/TS library that can be used to parse markdown streams as they are being read or generated.
It can be useful for LLM-powered applications that need to parse markdown streams in real-time.
This package is part of the NLUX ecosystem.
Usage
import {
MarkdownStreamParser,
MarkdownStreamParserOptions,
createMarkdownStreamParser,
} from "@nlux/markdown";
const options: MarkdownStreamParserOptions = {
};
const domElement = document.querySelector(".markdown-container");
const mdStreamParser: MarkdownStreamParser = createMarkdownStreamParser(
domElement!,
options,
);
mdStreamParser.next("## Hello World");
mdStreamParser.complete();
Interfaces
export type MarkdownStreamParser = {
next(value: string): void;
complete(): void;
};
export type MarkdownStreamParserOptions = {
markdownLinkTarget?: boolean;
syntaxHighlighter?: HighlighterExtension;
skipAnimation?: boolean;
onComplete?(completeCallback: Function): void;
};