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

upgrade to docusaurus 3 #9820

Merged
merged 8 commits into from
Mar 23, 2024
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
16 changes: 0 additions & 16 deletions .github/scripts/check-docusaurus-versions.sh

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/check-docusaurus-versions.yml

This file was deleted.

10 changes: 10 additions & 0 deletions frontend/docusaurus.config.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const lightCodeTheme = require('prism-react-renderer').themes.github
const darkCodeTheme = require('prism-react-renderer').themes.dracula
const stripCodeBlockLinks = require('./src/plugins/strip-code-block-links')

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand All @@ -24,6 +25,14 @@ const config = {
],
],

markdown: {
mdx1Compat: {
comments: true,
admonitions: true,
headingIds: true,
},
},

presets: [
[
'docusaurus-preset-openapi',
Expand All @@ -43,6 +52,7 @@ const config = {
api: {
path: 'categories',
routeBasePath: 'badges',
rehypePlugins: [stripCodeBlockLinks],
},
}),
],
Expand Down
14 changes: 5 additions & 9 deletions frontend/src/pages/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@ Shields.io is possible thanks to the people and companies who donate money, serv

<ul>
<li>
<a href="https://nodeping.com/">
NodePing
</a>
<a href="https://nodeping.com/">NodePing</a>
</li>
<li>
<a href="https://sentry.io/">
Sentry
</a>
<a href="https://sentry.io/">Sentry</a>
</li>
</ul>

Expand All @@ -24,7 +20,7 @@ Shields.io is possible thanks to the people and companies who donate money, serv
<p>
<object
data="https://opencollective.com/shields/tiers/sponsor.svg?avatarHeight=80&width=600"
class="opencollective-image"
className="opencollective-image"
></object>
</p>

Expand All @@ -35,7 +31,7 @@ Shields.io is possible thanks to the people and companies who donate money, serv
<p>
<object
data="https://opencollective.com/shields/tiers/backer.svg?width=600"
class="opencollective-image">
className="opencollective-image">
</object>
</p>

Expand All @@ -46,7 +42,7 @@ Shields.io is possible thanks to the people and companies who donate money, serv
<p>
<object
data="https://opencollective.com/shields/contributors.svg?width=600"
class="opencollective-image"
className="opencollective-image"
></object>
</p>

Expand Down
30 changes: 30 additions & 0 deletions frontend/src/plugins/strip-code-block-links.js
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
1 change: 1 addition & 0 deletions frontend/src/theme/ApiDemoPanel/Curl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ function Curl({ postman, codeSamples }) {
)}
key={lang.tabName || lang.label}
onClick={() => setLanguage(lang)}
type="button"
>
{lang.tabName || lang.label}
</button>
Expand Down
Loading
Loading