Mistakes email address for git commit and author
vweevers opened this issue · comments
Subject of the issue
remark-github
adds links to an email address that looks like a git commit and author.
Your environment
- Packages:
remark@11.0.1
,remark-github@8.0.0
,to-vfile@6.0.0
(latest)
Steps to reproduce
test.md
:
example1 (1234567@example.com)
example2 (abcdef0@example.com)
const vfile = require('to-vfile')
const remark = require('remark')
const github = require('remark-github')
remark()
.use(github, { repository: 'https://github.com/test/test' })
.process(vfile.readSync('test.md'), function (err, file) {
if (err) throw err
console.log(String(file))
})
Expected output
example1 (1234567@example.com)
example2 (abcdef0@example.com)
Actual output
example1 ([`1234567`](https://github.com/test/test/commit/1234567)[**@example**](https://github.com/example).com)
example2 ([`abcdef0`](https://github.com/test/test/commit/abcdef0)[**@example**](https://github.com/example).com)
Note: doesn't happen when the email address is enclosed in <>
. Is that the preferred solution, or should it be fixed in remark-github
?
example1 (1234567@example.com)
example2 (abcdef0@example.com)
They should get turned into normal links (to emails), as seen above (that's how gh does it)
Literals urls are a feature of GFM, and implemented on the remark level as GFM.
Literal urls are fragile, so I'd suggest using autolinks (< and >), and remark-stringify compiles to those.
It's a bug here!
narrator: it was instead a bug in remark: remarkjs/remark#475. The code here should work if that’s solved.
I found that GH does this on tokens too, not on the parse level (e.g., GH\-1
links, and so does \@wooorm
). Hence, I changed this plugin to work as a transformer, not a syntax plugin, effectively making your question work!