The π£πΌππ²πΏπ³ππΉ Conversational AI JavaScript Library π¬ βΒ UI for any LLM, supporting LangChain / HuggingFace / Vercel AI, and more 𧑠React, Next.js, and plain JavaScript βοΈ
Installations
npm install @nlux/markdown
Developer Guide
Typescript
Yes
Module System
CommonJS, UMD
Node Version
20.16.0
NPM Version
10.8.1
Score
72.8
Supply Chain
94.7
Quality
86
Maintenance
100
Vulnerability
81.3
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (93.1%)
CSS (5.31%)
JavaScript (1.58%)
Love this project? Help keep it running β sponsor us today! π
Developer
Download Statistics
Total Downloads
21,901
Last Day
14
Last Week
89
Last Month
553
Last Year
21,174
GitHub Statistics
NOASSERTION License
1,203 Stars
1,022 Commits
72 Forks
10 Watchers
1 Branches
11 Contributors
Updated on Feb 11, 2025
Bundle Size
39.73 kB
Minified
12.14 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.17.1
Package Id
@nlux/markdown@2.17.1
Unpacked Size
125.17 kB
Size
37.40 kB
File Count
7
NPM Version
10.8.1
Node Version
20.16.0
Published on
Aug 15, 2024
Total Downloads
Cumulative downloads
Total Downloads
21,901
Last Day
133.3%
14
Compared to previous day
Last Week
-27%
89
Compared to previous week
Last Month
-47.5%
553
Compared to previous month
Last Year
2,812.5%
21,174
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
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 UI toolkit for AI ecosystem.
Usage
Parsing Markdown Stream
1import { 2 MarkdownStreamParser, 3 MarkdownStreamParserOptions, 4 createMarkdownStreamParser, 5} from "@nlux/markdown"; 6 7const options: MarkdownStreamParserOptions = { 8 // markdownLinkTarget?: 'blank' | 'self'; // default: 'blank' 9 // syntaxHighlighter: (( Highlighter from @nlux/highlighter )), // default: undefined β for code blocks syntax highlighting 10 // showCodeBlockCopyButton?: boolean, // default: true β for code blocks 11 // skipStreamingAnimation?: boolean, // default: false 12 // streamingAnimationSpeed?: number, // default: 10 ( milliseconds ) 13 // waitTimeBeforeStreamCompletion?: number | 'never', // default: 2000 ( milliseconds ) 14 // onComplete: () => console.log("Parsing complete"), // triggered after the end of the stream 15}; 16 17const domElement = document.querySelector(".markdown-container"); 18const mdStreamParser: MarkdownStreamParser = createMarkdownStreamParser( 19 domElement!, 20 options, 21); 22 23// On each chunk of markdown 24mdStreamParser.next("## Hello World"); 25 26// To call when the markdown stream is complete 27// This indicates to the parser that now additional text will be added 28mdStreamParser.complete();
Parsing Markdown Snapshot
1import { parseMdSnapshot } from "@nlux/markdown"; 2const parsedMarkdown = parseMdSnapshot(snapshot, options);
Interfaces
1export type MarkdownStreamParser = { 2 next(value: string): void; 3 complete(): void; 4};
1export type MarkdownStreamParserOptions = { 2 markdownLinkTarget?: 'blank' | 'self'; 3 syntaxHighlighter?: HighlighterExtension; 4 skipStreamingAnimation?: boolean; 5 streamingAnimationSpeed?: number; 6 waitTimeBeforeStreamCompletion?: number | 'never'; 7 showCodeBlockCopyButton?: boolean; 8 onComplete?: () => void; 9};
1export type SnapshotParser = ( 2 snapshot: string, 3 options?: { 4 syntaxHighlighter?: HighlighterExtension, 5 htmlSanitizer?: SanitizerExtension; 6 markdownLinkTarget?: 'blank' | 'self', 7 showCodeBlockCopyButton?: boolean; 8 skipStreamingAnimation?: boolean; 9 }, 10) => string;

No vulnerabilities found.

No security vulnerabilities found.