Skip to content

feat: add tinylinkify, GFM links in plain text and a linkify-it drop-in - #35

Merged
vite-hub[bot] merged 10 commits into
mainfrom
feat/tinylinkify
Nov 16, 2026
Merged

vite-hub[bot] merged 10 commits into
mainfrom
feat/tinylinkify

Conversation

@onmax

@onmax onmax commented Nov 16, 2026

Copy link
Copy Markdown
Owner

markdown-exit 2 and markdown-it 15 use linkify-it 6, which doesn't link www.example.com, and GitHub and remark-gfm do. Moving a chat app from remark to markdown-exit loses those links. serkodev/markdown-exit#48 tried to fix it inside markdown-exit, and the maintainer would rather it lived in a separate package, so here it is.

This adds tinylinkify, with three entries:

  • tinylinkify: find and test for GFM autolink literals, the way remark-gfm finds them. 1.8 KiB gzip against 4.1 KiB for linkify-it 5.0.2, and about 2.8× faster.
  • tinylinkify/linkify-it: a drop-in for linkify-it 4 and 5. It's 4.11 → 3.90 KiB and passes 176 of 176 of linkify-it's own tests. tinyswap now migrates linkify-it to it.
  • tinylinkify/gfm: linkify-it's interface with GFM's rules, for markdown-it and markdown-exit, plus a plugin:
import { createMarkdownExit } from "markdown-exit/core";
import { linkifyGfm } from "tinylinkify/gfm";

const md = createMarkdownExit().use(linkifyGfm);

With it, markdown-exit links the same as remark-gfm on 98 of 98 chat messages, where linkify-it 6 gets 83.

The fuzzers found 0 differences: 6,002,040 calls against linkify-it, with Unicode punctuation from the engine, and 69,935 lines against remark-gfm's autolink step. Every place it still differs is listed under "what's different" in the README and on the compatibility page. One of them: in CommonJS TypeScript, import LinkifyIt = require(...) can't name LinkifyIt.Options, so import Options by name instead. A .d.cts would fix it, and I left that for later.

pnpm ready passes in packages/tinylinkify, and tinyswap's tests pass. AMD Ryzen 7 255, Node 24.21.0, Linux.

Related: serkodev/markdown-exit#48, serkodev/markdown-exit#47

Reviewed with sol-loop: 2 rounds with gpt-6.1-sol on xhigh. Sol verdict: approved

…a test that stops at the first link, and searches gated on what they need

Adds the named LinkifyIt export markdown-exit 2 and linkify-it 6 use, keeps the
links of a tested text for the match after it, and skips each search when the
text lacks the characters its links need. The root's budget rises to 1,870 B
and /gfm's to 2,300 B for that code.
… made them

A Codex review found four ways the shortcuts in match and the validators could
differ from linkify-it: a pattern recompiled or given its own methods in place,
lastIndex left as it was when a search was skipped, and the TLD check
converting a non-string a second time. Each shortcut now checks the pattern's
source, flags and built-in methods, resets lastIndex first, and takes strings
only; the fuzzer runs each of the reviewer's cases. The drop-in's budget rises
to 4,030 B for the checks.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T15:16:04.369321Z
We couldn’t complete this review. Comment @codex review to try again.
17e35ec PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pkg-pr-new

pkg-pr-new Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

tinyaml

pnpm add https://pkg.pr.new/onmax/tiny/tinyaml@35

tinyini

pnpm add https://pkg.pr.new/onmax/tiny/tinyini@35

tinyjson5

pnpm add https://pkg.pr.new/onmax/tiny/tinyjson5@35

tinylinkify

pnpm add https://pkg.pr.new/onmax/tiny/tinylinkify@35

tinyswap

pnpm add https://pkg.pr.new/onmax/tiny/tinyswap@35

commit: 78b8718

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Rejected URL candidates can make the GFM scanner block the event loop for seconds on an 80 KB message. This affects both the plain-text API and Markdown rendering and should be fixed before merging.

Reviewed changes — Reviewed all nine commits introducing tinylinkify and its repository integrations.

  • GFM recognition and integration: Adds the plain-text find/test API, the tinylinkify/gfm adapter, and the linkifyGfm plugin for markdown-it and markdown-exit.
  • linkify-it replacement: Adds the version 4/5-compatible entry with configurable schemas, TLDs, normalization, engine-derived Unicode punctuation, and guarded search optimizations.
  • Migration support: Registers linkify-it in tinyswap, including dependency replacement, import rewriting, and migration tests.
  • Verification and publication: Adds upstream suites, differential fuzzers, distribution tests, packaging, size checks, and benchmarks.
  • Documentation and tooling: Adds documentation pages, navigation, branding, comparison tables, and partial benchmark regeneration; updates the workspace lockfile.

Validation passed for tinylinkify's source and distribution tests (32 each), build/publint, lint/type checks, tinyswap's tests (153) and type check, and the documentation build. The size check reported tinylinkify/gfm is 2311 B gzip, over its budget of 2300 B on this runner; that small, zlib-dependent overage is not included as a defect finding.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

Comment thread packages/tinylinkify/src/core/gfm.ts Resolved
@vite-hub

vite-hub Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed 2026-11-16T16:17:39.459Z 2m 13s
View session Completed 2026-11-16T16:00:06.636Z 11m 15s

Latest result

Merged 78b8718 directly: required checks passed and review threads were resolved.

Final answers

Session

Merged 78b8718 directly: required checks passed and review threads were resolved.

View session

Pushed 78b8718 fixing the reported P1 quadratic scanning in both GFM recognition passes and resolved the review thread. Added scaling, Markdown rendering, and later-link offset regressions. All 24 focused tests and lint pass; 19,983 fuzz inputs match remark-gfm. Broader test wrappers encountered sandbox spawnSync EPERM errors. Awaiting hosted CI and automated review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. No P0 or P1 findings remain.

Reviewed changes — Re-reviewed 78b8718, the rejected-URL scanning fix added since the previous review at 17e35ec.

  • Bounded domain retries: Cached invalid final-label boundaries to avoid repeatedly scanning the same rejected domain suffix.
  • Deferred fallback suffix scans: Validated hosts before scanning paths and skipped equivalent rejected candidates while preserving later valid links.
  • Added regression coverage: Exercised rejected-input scaling through find, test, and markdown-exit, plus subsequent-link offsets.

Validation passed: 35 source tests, 35 distribution tests, build/publint, and lint/type checks. Another 59,962 fuzzed inputs and 12,960 targeted cases matched remark-gfm. The original 80 KB reproducer now used approximately 15–44 ms of CPU across the built public paths, versus roughly 11 seconds previously.

Pullfrog  | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

@vite-hub
vite-hub Bot merged commit afc0f2d into main Nov 16, 2026
11 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 16, 2026
onmax added a commit that referenced this pull request Nov 16, 2026
…www. (#36)

With fuzzyLink off, every www match was turned down, and each one read the
rest of its host again: 80 KB took 3.7 seconds. The search now has no www
to find then.

The fix for rejected candidates in #35 grew the root and tinylinkify/gfm
past their size budgets, by about 120 B gzip, so the budgets go to 1985 B
and 2460 B and the sizes in the docs to match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant