1.0.15 • Published 6 days ago
@nlux/markdown v1.0.15
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 = {
// skipAnimation: <true / false >, // default: false
// syntaxHighlighter: < Highlighter from @nlux/highlighter >
// onComplete: () => console.log("Parsing complete"),
};
const domElement = document.querySelector(".markdown-container");
const mdStreamParser: MarkdownStreamParser = createMarkdownStreamParser(
domElement!,
options,
);
// On each chunk of markdown
mdStreamParser.next("## Hello World");
// When the markdown stream is complete
mdStreamParser.complete();
Interfaces
export type MarkdownStreamParser = {
next(value: string): void;
complete(): void;
};
export type MarkdownStreamParserOptions = {
openMdLinksInNewWindow?: boolean;
syntaxHighlighter?: HighlighterExtension;
skipAnimation?: boolean;
onComplete?(completeCallback: Function): void;
};
2.0.2-alpha
6 days ago
2.0.1-alpha
6 days ago
1.0.15
7 days ago
1.0.14
8 days ago
1.0.13
8 days ago
1.0.12
8 days ago
1.0.9
9 days ago
2.0.0-alpha.1
9 days ago
1.0.10
9 days ago
1.0.8
26 days ago
1.0.7
1 month ago
1.0.6
1 month ago
1.0.5
1 month ago
1.0.4
1 month ago
1.0.2
2 months ago
1.0.3
2 months ago
1.0.1
2 months ago
1.0.0
2 months ago
0.12.2
2 months ago
0.12.1
3 months ago
0.12.0
3 months ago
0.11.2
3 months ago
0.11.0
3 months ago
0.11.1
3 months ago
0.10.11
3 months ago
0.10.10
3 months ago
0.10.9
3 months ago
0.10.8
3 months ago
0.10.7
3 months ago
0.10.6
3 months ago