mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-31 15:29:32 +02:00
1 line
No EOL
12 KiB
JavaScript
1 line
No EOL
12 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["23008"],{23491:function(e,t,r){r.d(t,{Z:function(){return n}});let n=r.p+"assets/images/social-card-e1b6e0c51be29d4ab2d4c966d220410c.png"},99203:function(e,t,r){r.d(t,{Z:function(){return n}});let n=r.p+"assets/images/broken-anchor-4191e5dd94aef9e8c5e3524880670f0f.jpg"},34873:function(e,t,r){r.d(t,{Z:function(){return n}});let n=r.p+"assets/images/social-card-e1b6e0c51be29d4ab2d4c966d220410c.png"},93e3:function(e,t,r){r.r(t),r.d(t,{assets:function(){return c},contentTitle:function(){return i},default:function(){return d},frontMatter:function(){return a},metadata:function(){return n},toc:function(){return l}});var n=r(70694),s=r(24246),o=r(80980);r(14522),r(51118),r(39468);let a={title:"Docusaurus 3.1",authors:["slorber"],tags:["release"],image:"./img/social-card.png",date:new Date("2024-01-05T00:00:00.000Z")},i=void 0,c={image:r(23491).Z,authorsImageUrls:[void 0]},l=[{value:"Highlights",id:"highlights",level:2},{value:"Broken anchors checker",id:"broken-anchors-checker",level:3},{value:"<code>parseFrontMatter</code> hook",id:"parsefrontmatter-hook",level:3},{value:"Other changes",id:"other-changes",level:2}];function u(e){let t={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:["We are happy to announce ",(0,s.jsx)(t.strong,{children:"Docusaurus 3.1"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["The upgrade should be easy: as explained in our ",(0,s.jsx)(t.a,{href:"/community/release-process",children:"release process documentation"}),", minor versions respect ",(0,s.jsx)(t.a,{href:"https://semver.org/",children:"Semantic Versioning"}),"."]}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.img,{alt:"Docusaurus blog post social card",src:r(34873).Z+"",width:"1200",height:"600"})}),"\n","\n",(0,s.jsx)(t.h2,{id:"highlights",children:"Highlights"}),"\n",(0,s.jsx)(t.h3,{id:"broken-anchors-checker",children:"Broken anchors checker"}),"\n",(0,s.jsxs)(t.p,{children:["In ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9528",children:"#9528"}),", we improved the built-in broken links checker to also detect broken anchors."]}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.img,{alt:"Docusaurus blog post social card",src:r(99203).Z+"",width:"1920",height:"896"})}),"\n",(0,s.jsxs)(t.admonition,{title:"Make it fail fast",type:"tip",children:[(0,s.jsxs)(t.p,{children:["The new ",(0,s.jsx)(t.a,{href:"/docs/api/docusaurus-config#onBrokenAnchors",children:(0,s.jsx)(t.code,{children:"onBrokenAnchors"})})," option has value ",(0,s.jsx)(t.code,{children:"warn"})," by default, for retro-compatibility reasons."]}),(0,s.jsxs)(t.p,{children:["We recommend to turn it to ",(0,s.jsx)(t.code,{children:"throw"})," and fail your CI builds instead of deploying broken anchors to productions."]})]}),"\n",(0,s.jsxs)(t.admonition,{type:"note",children:[(0,s.jsxs)(t.p,{children:["For users and plugin authors implementing custom ",(0,s.jsx)(t.code,{children:"<Heading>"})," and ",(0,s.jsx)(t.code,{children:"<Link>"})," components, we provide a new ",(0,s.jsx)(t.a,{href:"/docs/docusaurus-core#useBrokenLinks",children:(0,s.jsx)(t.code,{children:"useBrokenLinks"})})," React hook API."]}),(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.strong,{children:"Most Docusaurus users don't need to care about it"}),", built-in components (",(0,s.jsx)(t.code,{children:"docusaurus/Link"})," and ",(0,s.jsx)(t.code,{children:"@theme/Heading"}),") already use it internally."]})]}),"\n",(0,s.jsxs)(t.h3,{id:"parsefrontmatter-hook",children:[(0,s.jsx)(t.code,{children:"parseFrontMatter"})," hook"]}),"\n",(0,s.jsxs)(t.p,{children:["In ",(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9624",children:"#9624"}),", we added a new ",(0,s.jsxs)(t.a,{href:"/docs/api/docusaurus-config#markdown",children:[(0,s.jsx)(t.code,{children:"siteConfig.markdown.parseFrontMatter"})," function hook"]}),"."]}),"\n",(0,s.jsx)(t.p,{children:"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."}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-js",metastring:'title="docusaurus.config.js"',children:"export default {\n markdown: {\n // highlight-start\n parseFrontMatter: async (params) => {\n // Reuse the default parser\n const result = await params.defaultParseFrontMatter(params);\n\n // Process front matter description placeholders\n result.frontMatter.description =\n result.frontMatter.description?.replaceAll('{{MY_VAR}}', 'MY_VALUE');\n\n // Create your own front matter shortcut\n if (result.frontMatter.i_do_not_want_docs_pagination) {\n result.frontMatter.pagination_prev = null;\n result.frontMatter.pagination_next = null;\n }\n\n // Rename an unsupported front matter coming from another system\n if (result.frontMatter.cms_seo_summary) {\n result.frontMatter.description = result.frontMatter.cms_seo_summary;\n delete result.frontMatter.cms_seo_summary;\n }\n\n return result;\n },\n // highlight-end\n },\n};\n"})}),"\n",(0,s.jsxs)(t.p,{children:["Read the ",(0,s.jsx)(t.a,{href:"/docs/markdown-features#front-matter",children:"front matter guide"})," and the ",(0,s.jsxs)(t.a,{href:"/docs/api/docusaurus-config#markdown",children:[(0,s.jsx)(t.code,{children:"parseFrontMatter"})," API ref"]})," for details."]}),"\n",(0,s.jsx)(t.h2,{id:"other-changes",children:"Other changes"}),"\n",(0,s.jsx)(t.p,{children:"Other notable changes include:"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9674",children:"#9674"}),": add ",(0,s.jsx)(t.code,{children:"siteConfig.markdown.remarkRehypeOptions"})," to pass options to ",(0,s.jsx)(t.code,{children:"remark-rehype"}),", letting you customize things such as MDX footnote label"]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9671",children:"#9671"}),": add code block MagicComments support for (Visual) Basic/Batch/Fortran/COBOL/ML"]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9610",children:"#9610"}),": enable CLI port configuration via ",(0,s.jsx)(t.code,{children:"PORT"})," environment variable"]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9477",children:"#9477"}),": complete Brazilian Portuguese (pt-BR) translations"]}),"\n"]}),"\n",(0,s.jsxs)(t.p,{children:["Check the ",(0,s.jsx)(t.strong,{children:(0,s.jsx)(t.a,{href:"/changelog/3.1.0",children:"3.1.0 changelog entry"})})," for an exhaustive list of changes."]})]})}function d(e={}){let{wrapper:t}={...(0,o.a)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(u,{...e})}):u(e)}},51118:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(24246);r(27378);var s=r(14522);function o(e){var t=e.url;return(0,n.jsx)("div",{style:{padding:10},children:(0,n.jsx)(s.Z,{url:t,style:{minWidth:"min(100%,45vw)",width:800,maxWidth:"100%",overflow:"hidden"},bodyStyle:{padding:0},children:(0,n.jsx)("iframe",{src:t,title:t,style:{display:"block",width:"100%",height:300}})})})}},14522:function(e,t,r){r.d(t,{Z:()=>p});var n=r("24246");r("27378");var s=r("90496");let o="browserWindow_my1Q",a="browserWindowHeader_jXSR",i="buttons_uHc7",c="browserWindowAddressBar_Pd8y",l="dot_giz1",u="browserWindowMenuIcon_Vhuh",d="bar_rrRL",h="browserWindowBody_Idgs";function p(e){var t,r,p=e.children,m=e.minHeight,f=e.url,g=e.style,b=e.bodyStyle;return(0,n.jsxs)("div",{className:o,style:(t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,s,o;n=e,s=t,o=r[t],s in n?Object.defineProperty(n,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[s]=o})}return e}({},g),r=(r={minHeight:m},r),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t),children:[(0,n.jsxs)("div",{className:a,children:[(0,n.jsxs)("div",{className:i,children:[(0,n.jsx)("span",{className:l,style:{background:"#f25f58"}}),(0,n.jsx)("span",{className:l,style:{background:"#fbbe3c"}}),(0,n.jsx)("span",{className:l,style:{background:"#58cb42"}})]}),(0,n.jsx)("div",{className:(0,s.Z)(c,"text--truncate"),children:void 0===f?"http://localhost:3000":f}),(0,n.jsx)("div",{className:u,children:(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:d}),(0,n.jsx)("span",{className:d}),(0,n.jsx)("span",{className:d})]})})]}),(0,n.jsx)("div",{className:h,style:b,children:p})]})}},39468:function(e,t,r){r.d(t,{Z:function(){return a}});var n=r(24246),s=r(27378);function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function a(e){var t,r,a=e.children,i=e.message,c=e.cause;var l=(t=(0,s.useState)(!1),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,s=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=s){var o=[],a=!0,i=!1;try{for(s=s.call(e);!(a=(r=s.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){i=!0,n=e}finally{try{!a&&null!=s.return&&s.return()}finally{if(i)throw n}}return o}}(t,2)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(e,t)}}(t,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=l[0],d=l[1];if(u)throw Error(void 0===i?"Boom!\nSomething bad happened, but you can try again!":i,{cause:c?Error(c):void 0});return(0,n.jsx)("button",{className:"button button--danger",type:"button",onClick:function(){return d(!0)},children:void 0===a?"Boom!":a})}},80980:function(e,t,r){r.d(t,{Z:function(){return i},a:function(){return a}});var n=r(27378);let s={},o=n.createContext(s);function a(e){let t=n.useContext(o);return n.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),n.createElement(o.Provider,{value:t},e.children)}},70694:function(e){e.exports=JSON.parse('{"permalink":"/blog/releases/3.1","editUrl":"https://github.com/facebook/docusaurus/edit/main/website/blog/releases/3.1/index.mdx","source":"@site/blog/releases/3.1/index.mdx","title":"Docusaurus 3.1","description":"We are happy to announce Docusaurus 3.1.","date":"2024-01-05T00:00:00.000Z","tags":[{"inline":false,"label":"Release","permalink":"/blog/tags/release","description":"Blog posts about Docusaurus\' new releases"}],"readingTime":1.665,"hasTruncateMarker":true,"authors":[{"name":"S\xe9bastien Lorber","title":"Docusaurus maintainer, This Week In React editor","url":"https://thisweekinreact.com","page":{"permalink":"/blog/authors/slorber"},"description":"A freelance React and React-Native developer near Paris and Docusaurus maintainer. Also runs ThisWeekInReact.com, a newsletter to stay updated with the React ecosystem.\\n","socials":{"x":"https://x.com/sebastienlorber","linkedin":"https://www.linkedin.com/in/sebastienlorber/","github":"https://github.com/slorber","newsletter":"https://thisweekinreact.com"},"imageURL":"https://github.com/slorber.png","key":"slorber"}],"frontMatter":{"title":"Docusaurus 3.1","authors":["slorber"],"tags":["release"],"image":"./img/social-card.png","date":"2024-01-05T00:00:00.000Z"},"unlisted":false,"lastUpdatedAt":1729178406000,"lastUpdatedBy":"S\xe9bastien Lorber","prevItem":{"title":"Docusaurus 3.2","permalink":"/blog/releases/3.2"},"nextItem":{"title":"Announcing Docusaurus 3.0","permalink":"/blog/releases/3.0"}}')}}]); |