Closed
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
mdast-util-gfm-autolink-literal@1.0.0
Link to runnable example
No response
Steps to reproduce
Considering this broken markdown string (extracted from one of our user content):
\* \*\*Memory:\*\* \[Vengeance® Series 16GB \\(2x8GB\\) DDR4 SODIMM 2400MHz CL16 Memory Kit CMSX16GX4M2A2400C16](https://www.corsair.com/us/en/Categories/Products/Memory/Laptop-and-Notebook-Memory/Vengeance%C2%AE-Series-16GB-%282x8GB%29-DDR4-SODIMM-2400MHz-CL16-Memory-Kit/p/CMSX16GX4M2A2400C16#tab-overview)
\* \*\*Disk:\*\* M.2 NVMe \[Samsung 970 EVO 250GB \\(MZ-V7S250B/AM\\)](https://www.samsung.com/us/computing/memory-storage/solid-state-drives/ssd-970-evo-plus-nvme-m-2-250gb-mz-v7s250b-am/) and M.2 SSD \[Transcend 64GB SATA III 6 Gb/s MTS800](https://www.transcend-info.com/Embedded/Products/No-803)
Using the following JS code:
unified()
.use(remarkParse)
.use(remarkGfm)
.use(() => {
return (tree) => {
console.log(JSON.stringify(tree, null, 2));
return tree;
};
})
it results in the following tree:
{
"type": "root",
"children": [
{
"type": "paragraph",
"children": [
{
"type": "text",
"value": "* **Memory:** [Vengeance® Series 16GB \\(2x8GB\\) DDR4 SODIMM 2400MHz CL16 Memory Kit CMSX16GX4M2A2400C16]("
},
{
"type": "link",
"title": null,
"url": "https://www.corsair.com/us/en/Categories/Products/Memory/Laptop-and-Notebook-Memory/Vengeance%C2%AE-Series-16GB-%282x8GB%29-DDR4-SODIMM-2400MHz-CL16-Memory-Kit/p/CMSX16GX4M2A2400C16#tab-overview",
"children": [
{
"type": "text",
"value": "https://www.corsair.com/us/en/Categories/Products/Memory/Laptop-and-Notebook-Memory/Vengeance%C2%AE-Series-16GB-%282x8GB%29-DDR4-SODIMM-2400MHz-CL16-Memory-Kit/p/CMSX16GX4M2A2400C16#tab-overview"
}
]
},
{
"type": "text",
"value": ")"
},
{
"type": "break",
"position": {
"start": {
"line": 1,
"column": 314,
"offset": 313
},
"end": {
"line": 2,
"column": 1,
"offset": 316
}
}
},
{
"type": "text",
"value": "* **Disk:** M.2 NVMe [Samsung 970 EVO 250GB \\(MZ-V7S250B/AM\\)]("
},
{
"type": "link",
"title": null,
"url": "https://www.samsung.com/us/computing/memory-storage/solid-state-drives/ssd-970-evo-plus-nvme-m-2-250gb-mz-v7s250b-am/",
"children": [
{
"type": "text",
"value": "https://www.samsung.com/us/computing/memory-storage/solid-state-drives/ssd-970-evo-plus-nvme-m-2-250gb-mz-v7s250b-am/"
}
]
},
{
"type": "text",
"value": ")"
},
{
"type": "text",
"value": " and M.2 SSD [Transcend 64GB SATA III 6 Gb/s MTS800](https://www.transcend-info.com/Embedded/Products/No-803)"
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 2,
"column": 310,
"offset": 625
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 3,
"column": 1,
"offset": 626
}
}
}
Expected behavior
Instead it should be parsed the same way as GitHub does, as a pure text node.
Actual behavior
Links are detected in the content. It results in a tree containing links.
It also causes a bigger issue where the following is not true: input > parsed > markdown > parsed2 > markdown2
and markdown !== markdown2
.
Runtime
Node v14
Package manager
yarn v2
OS
macOS
Build and bundle tools
esbuild