Skip to content

feat: add a markdown-exit/linkify-gfm plugin that links like GitHub - #48

Closed
onmax wants to merge 1 commit into
serkodev:mainfrom
onmax:feat/linkify-gfm
Closed

onmax wants to merge 1 commit into
serkodev:mainfrom
onmax:feat/linkify-gfm

Conversation

@onmax

@onmax onmax commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

I'm moving the Chat SDK from remark to Comark, which parses with markdown-exit. Messages lose www.example.com links, because linkify-it 6 doesn't link them and remark-gfm did. linkify-it also adds 3.1 KiB gzip to markdown-exit/core.

This PR adds markdown-exit/linkify-gfm, a plugin that links with GitHub's rules (GFM autolinks) and doesn't use linkify-it. The default entry doesn't change.

import { createMarkdownExit } from 'markdown-exit/core'
import linkifyGfm from 'markdown-exit/linkify-gfm'

const md = createMarkdownExit().use(linkifyGfm)
linkify-it 6.1 this plugin
GFM spec autolink examples 3 / 11 10 / 11
core + linkifier, KiB gzip 36.6 35.5
same, on top of #47 35.5 33.3

The miss is ftp://, which remark-gfm skips too. linkify-it's fuzzyLink: true gets 8 / 11, but it also links bare domains like example.com. With #47, nothing imports uc.micro anymore, so the two PRs save more together. Render speed is the same on chat messages and up to 1.4x faster on link-heavy text.

It has no TLD list or custom schemas, so md.linkify.tlds() and add() throw. Inline markdown still parses first, so www.example.com/a*b*c links only up to /a.

The rules are a port of remark-gfm's autolink code. I first wrote them in onmax/tiny, where a fuzzer found 0 differences from remark-gfm on about 70,000 lines, and this port matches that code on 300,000 fuzzed inputs.

Related: #41, #47

@codspeed

codspeed Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing onmax:feat/linkify-gfm (eea710e) with main (ac3d1ed)

Open in CodSpeed

@serkodev

Copy link
Copy Markdown
Owner

Thank you for this PR. I think this fits better as a separate package or plugin than as part of markdown-exit.

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.

2 participants