Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔗 Link text transform should be idempotent #742

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/many-spoons-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-transforms': patch
---

Link text transform is run twice and should be idempotent
1 change: 1 addition & 0 deletions packages/myst-transforms/src/links/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down