Neo Zero

markdown

Pool

Modern, tree-shakeable markdown parser with TypeScript support

$ lpm install @lpm.dev/neo.markdown
33 exportsTypeScript

dist/blocks

Variables

codeBlockRule

Fenced code block rule (``` or ~~~)

indentedCodeBlockRule

Indented code block rule (4 spaces or tab)

headingBlockRule

ATX heading rule (# heading)

setextHeadingBlockRule

Setext heading rule (underlined with === or ---)

hrBlockRule

Horizontal rule (---, ***, ___)

tableBlockRule

GFM table rule

blockquoteBlockRule

Blockquote rule (> prefix)

listBlockRule

List rule (ordered and unordered, with task list support)

htmlBlockRule

HTML block rule (only active when allowHtml is true)

paragraphBlockRule

Paragraph rule (fallback for unmatched content)

allBlockRulesBlockRule[]

All built-in block rules in default priority order

dist/core

Classes

PluginBuilderImplimplements PluginBuilder

Internal plugin builder that collects plugin registrations

constructor(renderer: HtmlRenderer, options: ParserOptions)
MethodReturn TypeDescription
addBlockRule(rule)void
addInlineRule(rule)void
setRenderer(method, fn)void
addTokenTransform(fn)void
addHtmlTransform(fn)void
renderInline(tokens)string
renderBlock(tokens)string
PropertyTypeDescription
options
Readonly<ParserOptions>
blockRules
BlockRule[]Collected custom block rules
inlineRules
InlineRule[]Collected custom inline rules
rendererOverrides
Map<keyof Renderer, ((token: HeadingToken) => string) | ((token: ParagraphToken) => string) | ((token: CodeToken) => string) | ((token: HrToken) => string) | ((token: BlockquoteToken) => string) | ((token: ListToken) => string) | ((token: ListItemToken) => string) | ((token: HtmlBlockToken | HtmlInlineToken) => string) | ((token: TableToken) => string) | ((cells: string[]) => string) | ((text: string, align: "left" | "center" | "right" | null, header: boolean) => string) | ((token: DirectiveToken) => string) | ((token: TextToken) => string) | ((token: StrongToken) => string) | ((token: EmToken) => string) | ((token: DelToken) => string) | ((token: CodeInlineToken) => string) | ((token: LinkToken) => string) | ((token: ImageToken) => string) | ((token: BrToken) => string)>Collected renderer overrides (method name → function)
tokenTransforms
Array<(tokens: BlockToken[]) => BlockToken[]>Collected token transforms (run after tokenization)
htmlTransforms
Array<(html: string) => string>Collected HTML transforms (run after rendering)

dist/index-Bfx7r7DE

Classes

InlineTokenizer

Inline tokenizer class

constructor(customRules?: InlineRule[], options?: InlineTokenizerOptions)
MethodReturn TypeDescription
tokenize(src)InlineToken[]Tokenize inline markdown string Phase 6: Optimized with fast-path checks to avoid unnecessary regex execution

dist

Functions

parse
function parse(markdown: string, options?: ParserOptions): string

Parse markdown to HTML

ParameterTypeDescription
markdown
string- Markdown source string
optionsoptional
ParserOptions- Parser options

Variables

DEFAULT_ALLOWED_TAGSSet<string>

Default allowed tags (GitHub README-compatible)

DEFAULT_ALLOWED_ATTRIBUTESRecord<string, Set<string>>

Default allowed attributes per tag

dist/parser-BtuCD2P6

Functions

createParser
function createParser(options?: ParserOptions): Parser

Create a new parser instance

ParameterTypeDescription
optionsoptional
ParserOptions- Parser options

Classes

MarkdownParserimplements Parser

Markdown parser implementation

constructor(options?: ParserOptions)
MethodReturn TypeDescription
parse(markdown)stringParse markdown to HTML
tokenize(markdown)BlockToken[]Tokenize markdown to block tokens
render(tokens)stringRender tokens to HTML

dist/plugins/copy-code

Functions

copyCodePlugin
function copyCodePlugin(options?: CopyCodeOptions): MarkdownPlugin

Create the copy-code plugin

ParameterTypeDescription
optionsoptional
CopyCodeOptions- Copy-code options

dist/plugins/embeds

Functions

embedPlugin
function embedPlugin(options?: EmbedOptions): MarkdownPlugin

Create the embed plugin

ParameterTypeDescription
optionsoptional
EmbedOptions- Embed options

dist/plugins/embeds/react

Variables

YouTubeFC<YouTubeProps>
VimeoFC<VimeoProps>
TweetFC<TweetProps>
CodeSandboxFC<CodeSandboxProps>
CodePenFC<CodePenProps>
LoomFC<LoomProps>

dist/plugins/highlight

Functions

parseHighlightLines
function parseHighlightLines(meta?: string): number[] | undefined

Parse highlight line ranges from meta string Supports formats: {1,3-5}, {1}, {1,2,3}

ParameterTypeDescription
metaoptional
string- Code block meta string
highlightPlugin
function highlightPlugin(options: HighlightOptions): MarkdownPlugin

Create the highlight plugin

ParameterTypeDescription
options
HighlightOptions- Highlight options (grammars, tokenize, renderToHTML, theme, lineNumbers)

dist/plugins/toc

Functions

tocPlugin
function tocPlugin(options?: TocOptions): MarkdownPlugin

Create the TOC plugin

ParameterTypeDescription
optionsoptional
TocOptions- TOC options

dist/presets/commonmark

Functions

parse
function parse(markdown: string, options?: Partial<ParserOptions>): string

Parse markdown using CommonMark preset

ParameterTypeDescription
markdown
string- Markdown source string
optionsoptional
Partial<ParserOptions>- Additional parser options

dist/presets/gfm

Functions

parse
function parse(markdown: string, options?: Partial<ParserOptions>): string

Parse markdown using GFM preset

ParameterTypeDescription
markdown
string- Markdown source string
optionsoptional
Partial<ParserOptions>- Additional parser options

dist/renderer-Cc9gtqGb

Classes

HtmlRendererimplements Renderer

Default HTML renderer implementation

constructor(options?: HtmlRendererOptions)
MethodReturn TypeDescription
heading(token)stringRender heading
paragraph(token)stringRender paragraph
code(token)stringRender code block
hr(_token)stringRender horizontal rule
blockquote(token)stringRender blockquote
list(token)stringRender list
listitem(token)stringRender list item Phase 4: Added support for task list checkboxes (GFM extension)
html(token)stringRender HTML (if allowed)
table(token)stringRender table
tablerow(cells)stringRender table row
tablecell(text, align, header)stringRender table cell
directive(_token)stringRender directive (default: no-op, plugins override this)
applyOverrides(overrides)voidApply renderer method overrides from plugins
text(token)stringRender text
strong(token)stringRender strong (bold)
em(token)stringRender emphasis (italic)
del(token)stringRender strikethrough (del) Phase 4: GFM extension
codespan(token)stringRender inline code
link(token)stringRender link
image(token)stringRender image
br(_token)stringRender line break
renderBlock(tokens)stringRender block tokens to HTML
renderInline(tokens)stringRender inline tokens to HTML

dist/tokenizer-D0tixoEg

Classes

Tokenizer

Tokenizer class for parsing markdown into block tokens

constructor(options?: ParserOptions, customRules?: BlockRule[])
MethodReturn TypeDescription
tokenize(src)BlockToken[]Tokenize markdown string into block tokens
Unlimited AccessInstall as many Pool packages as you need.
Fund Real WorkEvery install you run sends revenue directly to the developer who built it.

Taxes calculated at checkout based on your location.

Weekly Installs
25
Version
1.2.1
Published
LicenseMIT
Size1.91 MB
Files84
Node version>= 18
TypeScriptYes