mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 08:19:07 +02:00
chore: upgrade rehype-katex with ESM support, update docs (#6320)
* chore: upgrade rehype-katex to latest version with ESM support and update the docs * Update documentation to reflect ESM upgrade is currently optional * rewording * final tweaks Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
parent
afe7464306
commit
4ebb1ca8c8
5 changed files with 273 additions and 21 deletions
|
@ -9,7 +9,6 @@
|
|||
const path = require('path');
|
||||
const versions = require('./versions.json');
|
||||
const math = require('remark-math');
|
||||
const katex = require('rehype-katex');
|
||||
const VersionsArchived = require('./versionsArchived.json');
|
||||
const {dogfoodingPluginInstances} = require('./_dogfooding/dogfooding.config');
|
||||
const npm2yarn = require('@docusaurus/remark-plugin-npm2yarn');
|
||||
|
@ -74,10 +73,10 @@ const config = {
|
|||
trailingSlash: isDeployPreview,
|
||||
stylesheets: [
|
||||
{
|
||||
href: 'https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css',
|
||||
href: 'https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.css',
|
||||
type: 'text/css',
|
||||
integrity:
|
||||
'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM',
|
||||
'sha384-MlJdn/WNKDGXveldHDdyRP1R4CTHr3FeuDNfhsLPYrq2t0UBkUdK2jyTnXPEK1NQ',
|
||||
crossorigin: 'anonymous',
|
||||
},
|
||||
],
|
||||
|
@ -261,7 +260,7 @@ const config = {
|
|||
showLastUpdateAuthor: true,
|
||||
showLastUpdateTime: true,
|
||||
remarkPlugins: [math, [npm2yarn, {sync: true}]],
|
||||
rehypePlugins: [katex],
|
||||
rehypePlugins: [],
|
||||
disableVersioning: isVersioningDisabled,
|
||||
lastVersion: isDev || isDeployPreview ? 'current' : undefined,
|
||||
onlyIncludeVersions: (() => {
|
||||
|
@ -517,6 +516,7 @@ async function createConfig() {
|
|||
const configTabs = (await import('./src/remark/configTabs.mjs')).default;
|
||||
const lightTheme = (await import('./src/utils/prismLight.mjs')).default;
|
||||
const darkTheme = (await import('./src/utils/prismDark.mjs')).default;
|
||||
const katex = (await import('rehype-katex')).default;
|
||||
config.plugins?.push(FeatureRequestsPlugin);
|
||||
// @ts-expect-error: we know it exists, right
|
||||
config.presets[0][1].docs.remarkPlugins.push(configTabs);
|
||||
|
@ -524,6 +524,8 @@ async function createConfig() {
|
|||
config.themeConfig.prism.theme = lightTheme;
|
||||
// @ts-expect-error: we know it exists, right
|
||||
config.themeConfig.prism.darkTheme = darkTheme;
|
||||
// @ts-expect-error: we know it exists, right
|
||||
config.presets[0][1].docs.rehypePlugins.push(katex);
|
||||
return config;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue