-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update packages * add plugin to strip autolinks in code blocks * fix all the documentation for MDXv3 * remove check-docusaurus-versions in docusaurus 3 this is now a hard error, not just a warning * port upstream change to Curl component fixes performing the 'execute' action when pressing enter
- Loading branch information
Showing
46 changed files
with
5,383 additions
and
3,907 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const { visit } = require('unist-util-visit') | ||
|
||
function stripCodeBlockLinks() { | ||
/* | ||
Docusaurus 3 uses [remark-gfm](https://github.com/remarkjs/remark-gfm) | ||
One of the "features" of remark-gfm is that it automatically looks for URLs | ||
and email addresses, and automatically wraps them in <a> tags. | ||
This happens even if the URL is inside a <code> block. | ||
This behaviour is | ||
a) mostly unhelpful and | ||
b) non-configurable | ||
This plugin removes <a> tags which appear inside a <code> block. | ||
*/ | ||
return tree => { | ||
visit(tree, ['mdxJsxTextElement', 'mdxJsxFlowElement', 'element'], node => { | ||
if (node.name === 'code' || node.tagName === 'code') { | ||
const links = node.children.filter(child => child.tagName === 'a') | ||
links.forEach(link => { | ||
const linkText = link.children.map(child => child.value).join('') | ||
const linkIndex = node.children.indexOf(link) | ||
node.children.splice(linkIndex, 1, { type: 'text', value: linkText }) | ||
}) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
module.exports = stripCodeBlockLinks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.