micromark-extension-gfm-autolink-literal

micromark syntax extension for GitHub-Flavored-Markdown autolink literals

Library
npm
v2.1.0
9stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
27/100Needs Attention
Development Activity0
Maintenance32
Community16
Maturity60
Momentum0

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
66/100Good
Architecture75
Code Quality85
Innovation58
Learning Curve45

micromark-extension-gfm-autolink-literal is a low-level tokenizer extension for the micromark markdown parser that adds GFM’s extra literal-autolink syntax: bare http(s):// URLs, www.-prefixed domains, and email addresses become recognized tokens during parsing without needing markdown link syntax. It implements GitHub’s parse-time autolinking algorithm; the companion transform-time algorithm (used for www./http/https links in issues, PRs, and comments) is handled separately by mdast-util-gfm-autolink-literal at the AST layer, since this package operates purely at the tokenizer level with no syntax tree.

As a micromark syntax extension, it is meant to be composed into a micromark parse call (or, more commonly, pulled in transitively through micromark-extension-gfm or remark-gfm) rather than installed and used directly by most developers. It ships an html compile extension alongside the syntax extension so consumers using micromark’s HTML compiler get correct autolink rendering out of the box.

What You Get

  • gfmAutolinkLiteral() syntax extension registering literal-autolink tokenization with micromark
  • gfmAutolinkLiteralHtml() compile extension for correct HTML output from micromark’s own HTML compiler
  • Faithful reproduction of GitHub’s parse-time autolink algorithm, including known edge cases from cmark-gfm
  • URI sanitization via micromark-util-sanitize-uri to avoid unsafe autolinked hrefs
  • Full TypeScript types with 100% enforced type coverage and a battery of fixture-based conformance tests

Common Use Cases

  • Assembling a custom micromark-based markdown parser that needs GFM autolinks without the full GFM extension bundle
  • Building a markdown-to-HTML pipeline (via micromark directly) that must linkify bare URLs and emails per GitHub’s rules
  • Providing the syntax layer underneath mdast-util-gfm-autolink-literal when working at the mdast/unified level
  • Verifying or testing markdown renderers against GitHub’s documented (and sometimes buggy) autolink edge cases

Under The Hood

Architecture - The published index.js/lib/ are generated by a tsc --build + micromark-build step from TypeScript-annotated JS source (not committed to the repo, per .gitignore), exposing a gfmAutolinkLiteral() tokenizer extension that plugs into micromark’s state-machine-based parser via its construct/effects API, plus a separate gfmAutolinkLiteralHtml() compile extension for micromark’s own HTML compiler — keeping tokenization and HTML rendering as two independently composable pieces.

Tech Stack - Plain JavaScript with JSDoc-driven TypeScript types, depending only on sibling micromark-util-* packages (character, sanitize-uri, symbol, types) from the same monorepo family, with dual development/default export conditions so a richer dev build can run in tests.

Code Quality - test/index.js (542 lines) drives conformance against dozens of paired .md/.html fixture files covering domain/path/www/email/character-reference edge cases (many mirroring documented cmark-gfm bugs), run under both dev and prod conditions with c8 --100 enforcing full statement coverage.

API Design - The two-function surface (gfmAutolinkLiteral(), gfmAutolinkLiteralHtml()) follows the same extension-factory convention used across every micromark-extension-* package, so it composes predictably into a micromark() call’s extensions/htmlExtensions arrays; the tradeoff is that this low-level API is rarely meant for direct use — most consumers reach it only transitively through remark-gfm or micromark-extension-gfm, so the learning curve is steep for anyone not already familiar with micromark’s extension model.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search