mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-11 07:12:29 +02:00
1 line
No EOL
18 KiB
JavaScript
1 line
No EOL
18 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["23265"],{55701:function(e,s,n){n.d(s,{Z:()=>t});let t={tabItem:"tabItem_pnkT"}},93195:function(e,s,n){n.d(s,{Z:()=>t});let t={tabList:"tabList_Qoir",tabItem:"tabItem_AQgk"}},67079:function(e,s,n){n.d(s,{Z:()=>t});let t={browserWindow:"browserWindow_my1Q",browserWindowHeader:"browserWindowHeader_jXSR",row:"row_KZDM",buttons:"buttons_uHc7",right:"right_oyze",browserWindowAddressBar:"browserWindowAddressBar_Pd8y",dot:"dot_giz1",browserWindowMenuIcon:"browserWindowMenuIcon_Vhuh",bar:"bar_rrRL",browserWindowBody:"browserWindowBody_Idgs"}},14150:function(e,s,n){n.d(s,{Z:()=>t});let t=n.p+"assets/images/social-card-7e038d19ea67c686e90e1f599f7256d0.png"},41550:function(e,s,n){n.d(s,{Z:()=>t});let t=n.p+"assets/images/social-card-7e038d19ea67c686e90e1f599f7256d0.png"},35122:function(e,s,n){n.r(s),n.d(s,{assets:()=>d,contentTitle:()=>u,default:()=>p,frontMatter:()=>c,metadata:()=>t,toc:()=>h});var t=n(28878),r=n(85893),a=n(80980),o=n(44456),i=n(4575),l=n(54636);let c={title:"Docusaurus 2.3",authors:["slorber"],tags:["release"],image:"./img/social-card.png",date:new Date("2023-01-27T00:00:00.000Z")},u=void 0,d={image:n(14150).Z,authorsImageUrls:[void 0]},h=[{value:"Highlights",id:"highlights",level:2},{value:"Google Tag Manager plugin",id:"google-tag-manager-plugin",level:3},{value:"Tabs Query String Support",id:"tabs-query-string-support",level:3},{value:"Nested admonitions",id:"nested-admonitions",level:3},{value:"Blog <code>createFeedItems</code>",id:"blog-createfeeditems",level:3},{value:"Translations",id:"translations",level:3},{value:"Other changes",id:"other-changes",level:2}];function g(e){let s={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.p,{children:["We are happy to announce ",(0,r.jsx)(s.strong,{children:"Docusaurus 2.3"}),"."]}),"\n",(0,r.jsxs)(s.p,{children:["The upgrade should be easy: as explained in our ",(0,r.jsx)(s.a,{href:"/community/release-process",children:"release process documentation"}),", minor versions respect ",(0,r.jsx)(s.a,{href:"https://semver.org/",children:"Semantic Versioning"}),"."]}),"\n",(0,r.jsx)(s.p,{children:(0,r.jsx)(s.img,{alt:"Docusaurus 2.2 social card",src:n(41550).Z+"",width:"1200",height:"600"})}),"\n",(0,r.jsx)(s.h2,{id:"highlights",children:"Highlights"}),"\n",(0,r.jsx)(s.h3,{id:"google-tag-manager-plugin",children:"Google Tag Manager plugin"}),"\n",(0,r.jsx)(s.p,{children:"Google Tag Manager is a tag management system that allows great flexibility. It enables analytics and marketing teams to easily load other third-party trackers and fire analytics tags."}),"\n",(0,r.jsxs)(s.p,{children:["We now have a ",(0,r.jsx)(s.a,{href:"/docs/api/plugins/@docusaurus/plugin-google-tag-manager/",children:(0,r.jsx)(s.code,{children:"@docusaurus/plugin-google-tag-manager"})})," package that you can use alongside or as an alternative to the existing ",(0,r.jsx)(s.a,{href:"/docs/api/plugins/@docusaurus/plugin-google-gtag/",children:"gtag.js plugin"})," (refer to ",(0,r.jsx)(s.a,{href:"https://support.google.com/tagmanager/answer/7582054",children:"this doc"})," to understand when to use which solution)."]}),"\n",(0,r.jsxs)(s.admonition,{title:"Google is sunsetting Universal Analytics",type:"warning",children:[(0,r.jsxs)(s.p,{children:[(0,r.jsx)(s.a,{href:"https://blog.google/products/marketingplatform/analytics/prepare-for-future-with-google-analytics-4/",children:"Google will sunset its Universal Analytics"})," on ",(0,r.jsx)(s.strong,{children:"July 1, 2023"}),", and ask users to migrate to ",(0,r.jsx)(s.strong,{children:"Google Analytics 4"}),"."]}),(0,r.jsxs)(s.p,{children:["Therefore, we are also ",(0,r.jsxs)(s.strong,{children:["deprecating our existing ",(0,r.jsx)(s.a,{href:"/docs/api/plugins/@docusaurus/plugin-google-analytics",children:(0,r.jsx)(s.code,{children:"@docusaurus/plugin-google-analytics"})})]})," package. Docusaurus users should create a new Google Analytics 4 property, and migrate to the ",(0,r.jsx)(s.a,{href:"/docs/api/plugins/@docusaurus/plugin-google-gtag/",children:"gtag.js plugin"}),", or the ",(0,r.jsx)(s.a,{href:"/docs/api/plugins/@docusaurus/plugin-google-tag-manager/",children:"Google Tag Manager plugin"}),". Refer to the ",(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/issues/7221",children:"dedicated Docusaurus issue"})," for details and questions."]})]}),"\n",(0,r.jsx)(s.h3,{id:"tabs-query-string-support",children:"Tabs Query String Support"}),"\n",(0,r.jsxs)(s.p,{children:["It is now possible to link a selected tab to a query string parameter. When a tab is selected, it will be stored in your browser URL as a ",(0,r.jsx)(s.code,{children:"?qs-param=tab-value"})," search parameter."]}),"\n",(0,r.jsx)(s.p,{children:"This feature allows deep-linking to a specific documentation tab that will pre-selected on page load."}),"\n",(0,r.jsxs)(s.p,{children:["When used alongside the ",(0,r.jsx)(s.code,{children:"groupId"})," prop, the query string tab value takes precedence over the ",(0,r.jsx)(s.code,{children:"localStorage"})," value."]}),"\n",(0,r.jsxs)(s.p,{children:["Make sure to check the ",(0,r.jsx)(s.a,{href:"/docs/markdown-features/tabs#query-string",children:"documentation"})," and the demo below to understand how it works:"]}),"\n","\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-tsx",children:'<Tabs groupId="current-os" queryString>\n <TabItem value="android" label="Android">\n Android\n </TabItem>\n <TabItem value="ios" label="iOS">\n iOS\n </TabItem>\n</Tabs>\n'})}),"\n",(0,r.jsx)(o.Z,{children:(0,r.jsxs)(i.Z,{groupId:"current-os",queryString:!0,children:[(0,r.jsx)(l.Z,{value:"android",label:"Android",children:(0,r.jsx)(s.p,{children:"Android"})}),(0,r.jsx)(l.Z,{value:"ios",label:"iOS",children:(0,r.jsx)(s.p,{children:"iOS"})})]})}),"\n",(0,r.jsx)(s.h3,{id:"nested-admonitions",children:"Nested admonitions"}),"\n",(0,r.jsx)(s.p,{children:"It is now possible to nest one admonition within another by adding extra colons for the outer/enclosing admonition:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-md",children:"::::tip[nested admonitions]\n\nYou can now nest one admonition within another!\n\n:::danger\n\nUse this sparingly when it makes sense.\n\n:::\n\n::::\n"})}),"\n",(0,r.jsxs)(s.admonition,{title:"nested admonitions",type:"tip",children:[(0,r.jsx)(s.p,{children:"You can now nest one admonition within another!"}),(0,r.jsx)(s.admonition,{type:"danger",children:(0,r.jsx)(s.p,{children:"Use this sparingly when it makes sense."})})]}),"\n",(0,r.jsxs)(s.h3,{id:"blog-createfeeditems",children:["Blog ",(0,r.jsx)(s.code,{children:"createFeedItems"})]}),"\n",(0,r.jsxs)(s.p,{children:["A new blog plugin option ",(0,r.jsx)(s.a,{href:"/docs/api/plugins/@docusaurus/plugin-content-blog/#CreateFeedItemsFn",children:(0,r.jsx)(s.code,{children:"feedOptions.createFeedItems"})})," gives you more control over the RSS/Atom feed generation. It is now possible to transform/filter/limit feed items through a new callback."]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-tsx",metastring:'title="docusaurus.config.js"',children:"[\n '@docusaurus/preset-classic',\n {\n blog: {\n feedOptions: {\n // highlight-start\n createFeedItems: async (params) => {\n const {blogPosts, defaultCreateFeedItems, ...rest} = params;\n return defaultCreateFeedItems({\n // keep only the 10 most recent blog posts in the feed\n blogPosts: blogPosts.filter((item, index) => index < 10),\n ...rest,\n });\n },\n // highlight-end\n },\n },\n },\n];\n"})}),"\n",(0,r.jsx)(s.h3,{id:"translations",children:"Translations"}),"\n",(0,r.jsx)(s.p,{children:"We added or completed the default theme translation support for multiple languages:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["\uD83C\uDDF8\uD83C\uDDEE ",(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8541",children:"#8541"})," Slovenian"]}),"\n",(0,r.jsxs)(s.li,{children:["\uD83C\uDDF9\uD83C\uDDF7 ",(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8289",children:"#8289"})," Turkish"]}),"\n",(0,r.jsxs)(s.li,{children:["\uD83C\uDDEE\uD83C\uDDF7 ",(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8406",children:"#8406"})," Farsi"]}),"\n",(0,r.jsxs)(s.li,{children:["\uD83C\uDDF5\uD83C\uDDF1 ",(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8525",children:"#8525"})," Polish"]}),"\n",(0,r.jsxs)(s.li,{children:["\uD83C\uDDE8\uD83C\uDDF3 ",(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8423",children:"#8423"})," Chinese"]}),"\n",(0,r.jsxs)(s.li,{children:["\uD83C\uDDF8\uD83C\uDDEA ",(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8312",children:"#8312"})," Swedish"]}),"\n",(0,r.jsxs)(s.li,{children:["\uD83C\uDDFB\uD83C\uDDF3 ",(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8450",children:"#8450"})," Vietnamese"]}),"\n"]}),"\n",(0,r.jsx)(s.admonition,{type:"tip",children:(0,r.jsxs)(s.p,{children:["Completing theme translations is an ",(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/issues/3526",children:"ongoing effort"})," and an easy way to contribute to Docusaurus. We add new theme features regularly, for which we often ",(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/issues/3526",children:"need new translations"}),"."]})}),"\n",(0,r.jsx)(s.h2,{id:"other-changes",children:"Other changes"}),"\n",(0,r.jsx)(s.p,{children:"Other notable changes include:"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8463",children:"#8463"})," and ",(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8328",children:"#8328"}),": fix some annoying Docusaurus layout issues"]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8539",children:"#8539"}),": Algolia plugin ",(0,r.jsx)(s.code,{children:"options.searchPagePath"})," should be correctly applied to search modal footer"]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8462",children:"#8462"}),": Algolia plugin now makes it easier to transform displayed search results with custom logic"]}),"\n",(0,r.jsxs)(s.li,{children:[(0,r.jsx)(s.a,{href:"https://github.com/facebook/docusaurus/pull/8397",children:"#8397"}),": the ",(0,r.jsx)(s.code,{children:"deploy"})," CLI now understands git url ",(0,r.jsx)(s.code,{children:"insteadOf"})," config"]}),"\n"]}),"\n",(0,r.jsxs)(s.p,{children:["Check the ",(0,r.jsx)(s.strong,{children:(0,r.jsx)(s.a,{href:"/changelog/2.3.0",children:"2.3.0 changelog entry"})})," for an exhaustive list of changes."]})]})}function p(e={}){let{wrapper:s}={...(0,a.a)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(g,{...e})}):g(e)}},54636:function(e,s,n){n.d(s,{Z:()=>o});var t=n(85893);n(67294);var r=n(90496),a=n(55701);function o(e){let{children:s,hidden:n,className:o}=e;return(0,t.jsx)("div",{role:"tabpanel",className:(0,r.Z)(a.Z.tabItem,o),hidden:n,children:s})}},4575:function(e,s,n){n.d(s,{Z:()=>g});var t=n(85893),r=n(67294),a=n(90496),o=n(54947),i=n(30623),l=n(71607),c=n(93195);function u(e){let{className:s,block:n,selectedValue:r,selectValue:i,tabValues:l}=e,u=[],{blockElementScrollPositionUntilNextRender:d}=(0,o.o5)(),h=e=>{let s=e.currentTarget,n=l[u.indexOf(s)].value;n!==r&&(d(s),i(n))},g=e=>{let s=null;switch(e.key){case"Enter":h(e);break;case"ArrowRight":{let n=u.indexOf(e.currentTarget)+1;s=u[n]??u[0];break}case"ArrowLeft":{let n=u.indexOf(e.currentTarget)-1;s=u[n]??u[u.length-1]}}s?.focus()};return(0,t.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,a.Z)("tabs",{"tabs--block":n},s),children:l.map(e=>{let{value:s,label:n,attributes:o}=e;return(0,t.jsx)("li",{role:"tab",tabIndex:r===s?0:-1,"aria-selected":r===s,ref:e=>{u.push(e)},onKeyDown:g,onClick:h,...o,className:(0,a.Z)("tabs__item",c.Z.tabItem,o?.className,{"tabs__item--active":r===s}),children:n??s},s)})})}function d(e){let{lazy:s,children:n,selectedValue:o}=e,i=(Array.isArray(n)?n:[n]).filter(Boolean);if(s){let e=i.find(e=>e.props.value===o);return e?(0,r.cloneElement)(e,{className:(0,a.Z)("margin-top--md",e.props.className)}):null}return(0,t.jsx)("div",{className:"margin-top--md",children:i.map((e,s)=>(0,r.cloneElement)(e,{key:s,hidden:e.props.value!==o}))})}function h(e){let s=(0,i.Y)(e);return(0,t.jsxs)("div",{className:(0,a.Z)("tabs-container",c.Z.tabList),children:[(0,t.jsx)(u,{...s,...e}),(0,t.jsx)(d,{...s,...e})]})}function g(e){let s=(0,l.Z)();return(0,t.jsx)(h,{...e,children:(0,i.h)(e.children)},String(s))}},30623:function(e,s,n){n.d(s,{Y:()=>d,h:()=>c});var t=n(67294),r=n(3620),a=n(844),o=n(97486),i=n(32263),l=n(16971);function c(e){return t.Children.toArray(e).filter(e=>"\n"!==e).map(e=>{if(!e||(0,t.isValidElement)(e)&&function(e){let{props:s}=e;return!!s&&"object"==typeof s&&"value"in s}(e))return e;throw Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)})?.filter(Boolean)??[]}function u(e){let{value:s,tabValues:n}=e;return n.some(e=>e.value===s)}function d(e){let{defaultValue:s,queryString:n=!1,groupId:d}=e,h=function(e){let{values:s,children:n}=e;return(0,t.useMemo)(()=>{let e=s??c(n).map(e=>{let{props:{value:s,label:n,attributes:t,default:r}}=e;return{value:s,label:n,attributes:t,default:r}}),t=(0,i.lx)(e,(e,s)=>e.value===s.value);if(t.length>0)throw Error(`Docusaurus error: Duplicate values "${t.map(e=>e.value).join(", ")}" found in <Tabs>. Every value needs to be unique.`);return e},[s,n])}(e),[g,p]=(0,t.useState)(()=>(function(e){let{defaultValue:s,tabValues:n}=e;if(0===n.length)throw Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(s){if(!u({value:s,tabValues:n}))throw Error(`Docusaurus error: The <Tabs> has a defaultValue "${s}" but none of its children has the corresponding value. Available values are: ${n.map(e=>e.value).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return s}let t=n.find(e=>e.default)??n[0];if(!t)throw Error("Unexpected error: 0 tabValues");return t.value})({defaultValue:s,tabValues:h})),[m,b]=function(e){let{queryString:s=!1,groupId:n}=e,a=(0,r.k6)(),i=function(e){let{queryString:s=!1,groupId:n}=e;if("string"==typeof s)return s;if(!1===s)return null;if(!0===s&&!n)throw Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:s,groupId:n});return[(0,o._X)(i),(0,t.useCallback)(e=>{if(!i)return;let s=new URLSearchParams(a.location.search);s.set(i,e),a.replace({...a.location,search:s.toString()})},[i,a])]}({queryString:n,groupId:d}),[f,x]=function(e){let{groupId:s}=e,n=s?`docusaurus.tab.${s}`:null,[r,a]=(0,l.Nk)(n);return[r,(0,t.useCallback)(e=>{n&&a.set(e)},[n,a])]}({groupId:d}),j=(()=>{let e=m??f;return u({value:e,tabValues:h})?e:null})();return(0,a.Z)(()=>{j&&p(j)},[j]),{selectedValue:g,selectValue:(0,t.useCallback)(e=>{if(!u({value:e,tabValues:h}))throw Error(`Can't select invalid tab value=${e}`);p(e),b(e),x(e)},[b,x,h]),tabValues:h}}},44456:function(e,s,n){n.d(s,{Z:()=>o});var t=n(85893);n(67294);var r=n(90496),a=n(67079);function o(e){let{children:s,minHeight:n,url:o="http://localhost:3000",style:i,bodyStyle:l}=e;return(0,t.jsxs)("div",{className:a.Z.browserWindow,style:{...i,minHeight:n},children:[(0,t.jsxs)("div",{className:a.Z.browserWindowHeader,children:[(0,t.jsxs)("div",{className:a.Z.buttons,children:[(0,t.jsx)("span",{className:a.Z.dot,style:{background:"#f25f58"}}),(0,t.jsx)("span",{className:a.Z.dot,style:{background:"#fbbe3c"}}),(0,t.jsx)("span",{className:a.Z.dot,style:{background:"#58cb42"}})]}),(0,t.jsx)("div",{className:(0,r.Z)(a.Z.browserWindowAddressBar,"text--truncate"),children:o}),(0,t.jsx)("div",{className:a.Z.browserWindowMenuIcon,children:(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:a.Z.bar}),(0,t.jsx)("span",{className:a.Z.bar}),(0,t.jsx)("span",{className:a.Z.bar})]})})]}),(0,t.jsx)("div",{className:a.Z.browserWindowBody,style:l,children:s})]})}},80980:function(e,s,n){n.d(s,{Z:()=>i,a:()=>o});var t=n(67294);let r={},a=t.createContext(r);function o(e){let s=t.useContext(a);return t.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function i(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:s},e.children)}},28878:function(e){e.exports=JSON.parse('{"permalink":"/blog/releases/2.3","editUrl":"https://github.com/facebook/docusaurus/edit/main/website/blog/releases/2.3/index.mdx","source":"@site/blog/releases/2.3/index.mdx","title":"Docusaurus 2.3","description":"We are happy to announce Docusaurus 2.3.","date":"2023-01-27T00:00:00.000Z","tags":[{"inline":false,"label":"Release","permalink":"/blog/tags/release","description":"Blog posts about Docusaurus\' new releases"}],"readingTime":3.67,"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.","socials":{"bluesky":"https://bsky.app/profile/sebastienlorber.com","x":"https://x.com/sebastienlorber","linkedin":"https://www.linkedin.com/in/sebastienlorber/","github":"https://github.com/slorber","instagram":"https://www.instagram.com/thisweekinreact","newsletter":"https://thisweekinreact.com"},"imageURL":"https://github.com/slorber.png","key":"slorber"}],"frontMatter":{"title":"Docusaurus 2.3","authors":["slorber"],"tags":["release"],"image":"./img/social-card.png","date":"2023-01-27T00:00:00.000Z"},"unlisted":false,"lastUpdatedAt":1748625776000,"lastUpdatedBy":"S\xe9bastien Lorber","prevItem":{"title":"Docusaurus 2.4","permalink":"/blog/releases/2.4"},"nextItem":{"title":"Docusaurus 2.2","permalink":"/blog/releases/2.2"}}')}}]); |