diff --git a/docusaurus.config.ts b/docusaurus.config.ts index ab3feea..cfb79c3 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -2,6 +2,11 @@ import path from 'path'; import { Config } from '@docusaurus/types'; import npm2yarn from '@docusaurus/remark-plugin-npm2yarn'; import { themes as prismThemes } from 'prism-react-renderer'; +import remarkGithubAdmonitionsToDirectives, { + DEFAULT_MAPPING, + DirectiveName, + GithubAlertType, +} from 'remark-github-admonitions-to-directives'; import apiLabels from './src/transformers/api-labels'; import apiOptionsClass from './src/transformers/api-options-class'; @@ -208,6 +213,18 @@ const config: Config = { '@docusaurus/preset-classic', { docs: { + path: 'docs', + beforeDefaultRemarkPlugins: [ + [ + remarkGithubAdmonitionsToDirectives, + { + mapping: { + ...DEFAULT_MAPPING, + [GithubAlertType.NOTE]: DirectiveName.INFO, + }, + }, + ], + ], sidebarPath: require.resolve('./sidebars.js'), routeBasePath: '/docs/', editUrl: ({ docPath }) => { @@ -226,6 +243,8 @@ const config: Config = { }, blog: { // See `node_modules/@docusaurus/plugin-content-blog/src/pluginOptionSchema.ts` for full undocumented options + path: 'blog', + beforeDefaultRemarkPlugins: [remarkGithubAdmonitionsToDirectives], blogSidebarCount: 'ALL', blogSidebarTitle: 'Latest posts', blogTitle: `Electron's blog`, diff --git a/package.json b/package.json index 4f40634..879a909 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "react-dom": "^18.3.1", "react-markdown": "^9.0.1", "react-useportal": "^1.0.14", + "remark-github-admonitions-to-directives": "^2.0.0", "sass": "^1.37.5", "semver": "^7.5.4", "yaml": "^2.4.3" diff --git a/yarn.lock b/yarn.lock index 3b4a086..c6e032d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13050,6 +13050,16 @@ remark-gfm@^4.0.0: remark-stringify "^11.0.0" unified "^11.0.0" +remark-github-admonitions-to-directives@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/remark-github-admonitions-to-directives/-/remark-github-admonitions-to-directives-2.1.0.tgz#5bdb5deb3e1d6ee7a1427aeea9e27e7b3ea96ff4" + integrity sha512-bI3E4Oj1pKY3ym2IQrrVCdORgEu0+mSrWgpCYFNy8QvytfnLs/nAacVPjkWU/JzDMUiQio2k4nTFP7bsIr9TSA== + dependencies: + "@types/mdast" "^4.0.0" + mdast-util-directive "^3.0.0" + unified "^11.0.0" + unist-util-visit "^5.0.0" + remark-mdx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/remark-mdx/-/remark-mdx-3.0.1.tgz#8f73dd635c1874e44426e243f72c0977cf60e212"