Autolink bug
chenxsan opened this issue · comments
Sam Chen commented
Subject of the issue
Here's the markdown text:
Please use relative URLs (/concepts/mode/) to link our own content instead of absolute URLs (https://webpack.js.org/concepts/mode/).
It renders into:
<p>Please use relative URLs (/concepts/mode/) to link our own content instead of absolute URLs (<a href="https://webpack.js.org/concepts/mode/)">https://webpack.js.org/concepts/mode/)</a>.</p>
As you can see, there's a superfluous )
at the end of href
of the a
element.
Steps to reproduce
Here's the code to run:
var vfile = require('to-vfile')
var report = require('vfile-reporter')
var unified = require('unified')
var parse = require('remark-parse')
var gfm = require('remark-gfm')
var remark2rehype = require('remark-rehype')
var stringify = require('rehype-stringify')
unified()
.use(parse)
.use(gfm)
.use(remark2rehype)
.use(stringify)
.process(`Please use relative URLs (/concepts/mode/) to link our own content instead of absolute URLs (https://webpack.js.org/concepts/mode/).`, function (err, file) {
console.error(report(err || file))
console.log(String(file))
})
Expected behavior
No superfluous )
at the end of href
.
Actual behavior
Superfluous )
included in href
.
PS
You can see how github renders the markdown below:
Please use relative URLs (/concepts/mode/) to link our own content instead of absolute URLs (https://webpack.js.org/concepts/mode/).
Titus commented
Nice catch!