Correction semi-automatique des liens morts
This commit is contained in:
@@ -24,7 +24,8 @@ test("collectMarkdownLinksFromStream preserves line numbers", async () => {
|
||||
"Markdown [link](https://docs.example.org/page(with more valid content)).",
|
||||
"Le **[baume du Canada](https://fr.wikipedia.org/wiki/Baume_du_Canada)**",
|
||||
"(_Theropoda [incertae sedis](https://fr.wikipedia.org/wiki/Incertae_sedis)_)",
|
||||
"[CDN](https://fr.wikipedia.org/wiki/Réseau_de_diffusion_de_contenu)[^2]."
|
||||
"[CDN](https://fr.wikipedia.org/wiki/Réseau_de_diffusion_de_contenu)[^2].",
|
||||
"(heu... [oui](https://github.com/opencart/opencart/tree/master/upload/system/storage/vendor)...)"
|
||||
].join("\n");
|
||||
const stream = Readable.from([content]);
|
||||
const links = await collectMarkdownLinksFromStream(stream);
|
||||
@@ -36,10 +37,11 @@ test("collectMarkdownLinksFromStream preserves line numbers", async () => {
|
||||
{ url: "https://fr.wikipedia.org/wiki/Baume_du_Canada", line: 6 },
|
||||
{ url: "https://fr.wikipedia.org/wiki/Incertae_sedis", line: 7 },
|
||||
{ url: "https://fr.wikipedia.org/wiki/Réseau_de_diffusion_de_contenu", line: 8 },
|
||||
{ url: "https://github.com/opencart/opencart/tree/master/upload/system/storage/vendor", line: 9 },
|
||||
]);
|
||||
});
|
||||
|
||||
test("collectMarkdownLinksFromStream ignores URLs in front matter comments", async () => {
|
||||
test("collectMarkdownLinksFromStream ignores URLs in front matter entirely", async () => {
|
||||
const content = [
|
||||
"---",
|
||||
"links:",
|
||||
@@ -51,7 +53,6 @@ test("collectMarkdownLinksFromStream ignores URLs in front matter comments", asy
|
||||
const stream = Readable.from([content]);
|
||||
const links = await collectMarkdownLinksFromStream(stream);
|
||||
assert.deepStrictEqual(links, [
|
||||
{ url: "https://included.example.com", line: 4 },
|
||||
{ url: "https://body.example.com", line: 6 },
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user