diff --git a/.changeset/many-spoons-beg.md b/.changeset/many-spoons-beg.md new file mode 100644 index 000000000..c31a1b730 --- /dev/null +++ b/.changeset/many-spoons-beg.md @@ -0,0 +1,5 @@ +--- +'myst-transforms': patch +--- + +Link text transform is run twice and should be idempotent diff --git a/packages/myst-transforms/src/links/plugin.ts b/packages/myst-transforms/src/links/plugin.ts index 2742a6b60..0e7bbf9a4 100644 --- a/packages/myst-transforms/src/links/plugin.ts +++ b/packages/myst-transforms/src/links/plugin.ts @@ -19,6 +19,7 @@ function formatLinkText(link: Link) { const url = link.children[0].value; // Add an exception for wiki transforms links. if (url.length < 20 || url.match(/\s/) || url.startsWith('wiki:')) return; + if (url.includes('​')) return; // Split the URL into an array to distinguish double slashes from single slashes const doubleSlash = url.split('//'); // Format the strings on either side of double slashes separately