- Add
<Redirect>component for easy client side redirect. Example Usage:
import React from 'react';
import {Redirect} from '@docusaurus/router';
function Home() {
return <Redirect to="/docs/test" />;
}- Allow user to add custom HTML to footer items. #1905
- Added code block line highlighting feature (thanks @lex111)! If you have previously swizzled the
CodeBlocktheme component, it is recommended to update your source code to have this feature. (#1860)
- Fixed a bug in which if
themeConfig.algoliais not defined, the custom searchbar won't appear. If you've swizzled AlgoliaSearchBarcomponent before, please update your source code otherwise CSS might break. See #1909 for reference.
- <Fragment>
+ <div className="navbar__search" key="search-box">- Slightly adjust search icon position to be more aligned on small width device. (#1893)
- Fix algolia styling bug, previously search suggestion result is sometimes hidden. (#1915)
- Changed the way we read the
USE_SSHenv variable during deployment to be the same as in v1. - Fix accessing
docs/or/docs/xxxxthat does not match any existing doc page should return 404 (Not found) page, not blank page. (#1903) - Prioritize
@docusaurus/coredependencies/ node_modules over user's node_modules. This fix a bug whereby if user has core-js@3 on its own node_modules but docusaurus depends on core-js@2, we previously encounterModule not found: core-js/modules/xxxx(because core-js@3 doesn't have that). - Fix a bug where docs plugin add
/docsroute even if docs folder is empty. We also improved docs plugin test coverage to 100% for stability before working on docs versioning. (#1912)
- Reduce memory usage consumption. (#1900)
- Significantly reduce main bundle size and initial HTML payload on production build. Generated files from webpack is also shorter in name. (#1898)
- Simplify blog metadata. Previously, accessing
/blog/post-xxxwill request for next and prev blog post metadata too aside from target post metadata. We should only request target post metadata. (#1908)
- Footer is now sticky/ pinned to the bottom of the viewport in desktop browsers.
- Footer is now also displayed in docs page for consistency.
- Remove empty doc sidebar container if sidebar for a particular doc page does not exist. Otherwise, it will cause an additional empty space.
- Default PostCSS loader now only polyfills stage 3+ features (previously it was stage 2) like Create React App. Stage 2 CSS is considered relatively unstable and subject to change while Stage 3 features will likely become a standard.
- Fix search bar focus bug. When you put the focus on search input, previously the focus will remain although we have clicked to other area outside of the search input.
- New themeConfig option
sidebarCollapsible. It is on by default. If explicitly set tofalse, all doc items in sidebar is expanded. Otherwise, it will still be a collapsible sidebar. - Disable adding hashes to the generated class names of CSS modules in dev mode. Generating unique identifiers takes some time, which can be saved since including paths to files in class names is enough to avoid collisions.
- Fix showing sidebar category with empty items.
- Update infima from 0.2.0-alpha.2 to 0.2.0-alpha.3
- Fix pagination nav and right sidebar color contrast ratio
- Fix sidebar arrow color in dark mode
- Fix footer mobile issue
- Increase sidebar width
- etc
- Fix babel transpilation include/exclude logic to be more efficient. This also fix a very weird bug
TypeError: Cannot assign to read only property 'exports' of object '#<Object>'.(#1868)
If you are still encountering the error. Please check whether you use module.exports for your .js file instead of doing export (mixing CJS and ES). See webpack/webpack#4039 (comment) and webpack/webpack#4039 (comment) for more context.
HOTFIX for 2.0.0-alpha.28.
- Fix missing
core-jsdependencies on@docusaurus/core. - Fix wrong
@babel/envpreset configuration that causes build compilation error. - New UI for webpack compilation progress bar.
- Further reduce memory usage to avoid heap memory allocation failure.
- Fix
keywordsfrontmatter for SEO not working properly. - Fix
swizzlecommand not passing context properly to theme packages. - Add
extendCliapi for plugins. This will allow plugin to further extend Docusaurus CLI. - Fix
swizzlecommand not being able to swizzle single js file. - Fix logo URL in footer to be appended with baseUrl automatically.
- Add the option
--no-openforstartcommand. - Set
@babel/envuseBuiltins tousage. This will automatically use browserlist and import polyfills required. - Modified TerserWebpackPlugin
terserOptionsfor better cross-browser compatibility. - BREAKING
withBaseUrlis renamed touseBaseUrlbecause its a React Hooks. Make sure you import/rename it correctly. Eg:import useBaseUrl from '@docusaurus/useBaseUrl; - Fix potential security vulnerability because we're exposing the directory structure of the host machine.
- Upgrade dependencies.
- Add
@theme/Tabswhich can be used to implement multi-language code tabs. - Implement
custom_edit_urlandhide_titlemarkdown header for docusaurus v1 feature parity. - Reduce memory usage and slightly faster production build.
- Misc dependency upgrades.
- Docs, pages plugin is rewritten in TypeScript
- Docs improvements and tweaks
- Improved metadata which results in smaller bundle size.
- Docs sidebar can now be more than one level deep, theoretically up to infinity
- Collapsible docs sidebar!
- Make doc page title larger
- Add
editUrloption (URL for editing) to docs plugin. If this field is set, there will be an "Edit this page" link for each doc page. Example: 'https://github.com/facebook/docusaurus/edit/master/docs' - Add
showLastUpdateTimeandshowLastUpdateAuthoroptions to docs plugin to further achieve v1 parity of showing last update data for a particular doc
- Slight tweaks to the Blog components - blog title is larger now
- Code Blocks
- Change default theme from Night Owl to Palenight
- Slight tweaks to playground/preview components
- Add
scriptsandstylesheetsfield todocusaurus.config.js - More documentation...
- Blog plugin is rewritten in TypeScript and can now support CJK
- Upgrade key direct dependencies such as webpack, mdx and babel to latest
- Do not escape html and body attributes
- For devices with very small viewport width, the searchbar is replaced with a search icon. On tap of the search icon the searchbar is expanded and the text beside the logo is hidden and remains hidden while the search bar is expanded.
- Add
datefrontMatter support for blog plugin - Add
truncateMarkeroption to blog plugin, support string or regex. - Webpack
optimization.removeAvailableModulesis now disabled for performance gain. See https://github.com/webpack/webpack/releases/tag/v4.38.0 for more context.
- Remove unused metadata for pages. This minimize number of http request & smaller bundle size.
- Upgrade dependencies of css-loader from 2.x to 3.x. Css modules localIdentName hash now only use the last 4 characters instead of 8.
- Fix broken markdown linking replacement for mdx files
- Fix potential security vulnerability because we're exposing the directory structure of the host machine. Instead of absolute path, we use relative path from site directory. Resulting in shorter webpack chunk naming and smaller bundle size.
- Use contenthash instead of chunkhash for better long term caching
- Allow user to customize generated heading from MDX. Swizzle
@theme/Heading
- Fix docusaurus route config generation for certain edge case
- Add missing dependencies on
@docusaurus/preset-classic - New plugin
@docusaurus/plugin-ideal-imageto generate an almost ideal image (responsive, lazy-loading, and low quality placeholder) - Better Twitter/discord image preview. Previously the size is too zoomed
- Allow prism syntax highlighting theme customization. Refer to https://v2.docusaurus.io/docs/markdown-features#syntax-highlighting
- CSS is now autoprefixed using postcss
- Faster, lighter webpack bundle size
@docusaurus/theme-live-codeblockis now much smaller in size and no longer only load on viewport- Blog markdown files now support using the id field to specify the path
- Fix babel-loader not transpiling docusaurus package
- Add copy codeblock button
- Add Google analytics and Google gtag plugins.
- Move source components to
/src. Please create awebsite/srcdirectory and move your/pagesand/themecode into it. This is to make it easier to integrate your website with external build/static analysis tooling (you can now just pass insrc/**/*.jsas the path to process). - Adde more documentation thanks to @wgao19.
- Deprecate the current docs plugin. The docs plugin as of 2.0.0-alpha.19 is heavily based on V1 specifications and we intend to create a better one that fixes some of the inconsistencies in V1. If you have swizzled any doc components, you will have to update their names. You are highly encourages to not swizzle the legacy doc components until we have completed the new docs plugin.
- Separate v2 init command to new package @docusaurus/init
- Render 404.html page
- Improve SEO
- Clicking on the logo in the mobile sliding navigation will now bring you to the homepage.
- Performance
- Disable webpack output pathinfo. Webpack has the ability to generate path info in the output bundle. However, this puts garbage collection pressure on projects that bundle thousands of modules. Not very useful for our case
- Drop cache-loader in CI and test environment because it has an initial overhead. We always start from scratch in vm instance like CI so cache-loader is useless
- Better splitchunks and babel default webpack config
- Add a sensible default for browserslist config.
- UI
- Add sun and moon emoji to the dark mode toggle.
- Mobile responsive menu.
- Right table of contents for docs is now sticky.
- Plugins
- Change plugin definitions from classes to functions. Refer to the new plugin docs.
- Implement Clients module API.
- Change format within
docusaurus.config.jsto be like presets.
- Deps
- Infima CSS is now locked down to specific versions and not relying upon the CDN which reads from trunk.
- Update dependencies to latest
- Customize/ Override infima CSS variables by passing options into the classic preset.
presets: [
[
'@docusaurus/preset-classic',
{
theme: {
customCss: require.resolve('./css/custom.css'),
},
...
},
],
],
- Allow passing remark and rehype plugins to mdx-loader for docs and blog plugin
- Move themes component of docs and blog to be part of theme-classic
- Use composition style for prism syntax highlighting instead of doing it via rehype plugin
- Pass MDXProvider to docs and blog. To change the provided MDX components, run
docusaurus swizzle @docusaurus/theme-classic MDXComponents - Add @docusaurus/theme-livecodeblock plugin
- Better run-time code generation & webpack splitchunks optimization
- Minify css for production build
- Fix weird scrolling problem when navigating to a route with a
hashlocation
siteConfig.jsrenamed todocusaurus.config.js.- Remove the following config options:
docsUrl. Use the plugin option ondocusaurus-plugin-content-docsinstead.customDocsPath. Use the plugin option ondocusaurus-plugin-content-docsinstead.sidebars.jsonnow has to be explicitly loaded by users and passed into the the plugin option ondocusaurus-plugin-content-docs.headerLinksdoc, page, blog is deprecated and has been to moved intothemeConfigunder the namenavbar. The syntax is now:
themeConfig: {
navbar: {
title: 'Docusaurus',
logo: {
alt: 'Docusaurus Logo',
src: 'img/docusaurus.svg',
},
links: [
{to: 'docs/introduction', label: 'Docs', position: 'left'},
{to: 'blog', label: 'Blog', position: 'left'},
{to: 'feedback', label: 'Feedback', position: 'left'},
{
href: 'https://github.com/facebook/docusaurus',
label: 'GitHub',
position: 'right',
},
],
},
}Work in Progress
- Add presets for plugins that follow the Babel preset convention.