메인 컨텐츠로 이동

Docusaurus 3.1

· 3분 읽기 분량
세바스티앵 로버(Sébastien Lorber)
Docusaurus maintainer, This Week In React editor

We are happy to announce Docusaurus 3.1.

업그레이드 과정은 간단합니다. 도큐사우루스는 릴리스 프로세스 문서에 설명된 대로 시맨틱 버전 체계를 준수해 마이너 버전은 하위 호환성을 유지합니다.

Docusaurus blog post social card

새로 추가된 기능

Broken anchors checker

In #9528, we improved the built-in broken links checker to also detect broken anchors.

Docusaurus blog post social card

Make it fail fast

The new onBrokenAnchors option has value warn by default, for retro-compatibility reasons.

We recommend to turn it to throw and fail your CI builds instead of deploying broken anchors to productions.

참고

For users and plugin authors implementing custom <Heading> and <Link> components, we provide a new useBrokenLinks React hook API.

Most Docusaurus users don't need to care about it, built-in components (docusaurus/Link and @theme/Heading) already use it internally.

parseFrontMatter hook

In #9624, we added a new siteConfig.markdown.parseFrontMatter function hook.

This makes it possible to implement convenient front matter transformations, shortcuts, or to integrate with external systems using front matter that Docusaurus plugins do not support.

docusaurus.config.js
export default {
markdown: {
parseFrontMatter: async (params) => {
// Reuse the default parser
const result = await params.defaultParseFrontMatter(params);

// Process front matter description placeholders
result.frontMatter.description =
result.frontMatter.description?.replaceAll('{{MY_VAR}}', 'MY_VALUE');

// Create your own front matter shortcut
if (result.frontMatter.i_do_not_want_docs_pagination) {
result.frontMatter.pagination_prev = null;
result.frontMatter.pagination_next = null;
}

// Rename an unsupported front matter coming from another system
if (result.frontMatter.cms_seo_summary) {
result.frontMatter.description = result.frontMatter.cms_seo_summary;
delete result.frontMatter.cms_seo_summary;
}

return result;
},
},
};

Read the front matter guide and the parseFrontMatter API ref for details.

기타 변경

기타 주목할만한 변경 사항은 다음과 같습니다.

  • #9674: add siteConfig.markdown.remarkRehypeOptions to pass options to remark-rehype, letting you customize things such as MDX footnote label
  • #9671: add code block MagicComments support for (Visual) Basic/Batch/Fortran/COBOL/ML
  • #9610: enable CLI port configuration via PORT environment variable
  • #9477: complete Brazilian Portuguese (pt-BR) translations

Check the 3.1.0 changelog entry for an exhaustive list of changes.