mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-03 20:27:20 +02:00
1 line
No EOL
13 KiB
JavaScript
1 line
No EOL
13 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[16637],{25592:(e,t,l)=>{l.d(t,{A:()=>u});var n=l(62540);l(63696);var r=l(11750),o=l(27720),i=l(46733),c=l(81912);let s={tocCollapsibleButton:"tocCollapsibleButton_IbtT",tocCollapsibleButtonExpanded:"tocCollapsibleButtonExpanded_Nor3"};function a(e){var t,l,{collapsed:o}=e,i=function(e,t){if(null==e)return{};var l,n,r=function(e,t){if(null==e)return{};var l,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)l=o[n],t.indexOf(l)>=0||(r[l]=e[l]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)l=o[n],!(t.indexOf(l)>=0)&&Object.prototype.propertyIsEnumerable.call(e,l)&&(r[l]=e[l])}return r}(e,["collapsed"]);return(0,n.jsx)("button",(t=function(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{},n=Object.keys(l);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(l).filter(function(e){return Object.getOwnPropertyDescriptor(l,e).enumerable}))),n.forEach(function(t){var n;n=l[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({type:"button"},i),l=l={className:(0,r.A)("clean-btn",s.tocCollapsibleButton,!o&&s.tocCollapsibleButtonExpanded,i.className),children:(0,n.jsx)(c.A,{id:"theme.TOCCollapsible.toggleButtonLabel",description:"The label used by the button on the collapsible TOC component",children:"On this page"})},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(l)):(function(e,t){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);l.push.apply(l,n)}return l})(Object(l)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(l,e))}),t))}let d={tocCollapsible:"tocCollapsible_BEWm",tocCollapsibleContent:"tocCollapsibleContent_FG8F",tocCollapsibleExpanded:"tocCollapsibleExpanded_FzA_"};function u({toc:e,className:t,minHeadingLevel:l,maxHeadingLevel:c}){let{collapsed:s,toggleCollapsed:u}=(0,o.u)({initialState:!0});return(0,n.jsxs)("div",{className:(0,r.A)(d.tocCollapsible,!s&&d.tocCollapsibleExpanded,t),children:[(0,n.jsx)(a,{collapsed:s,onClick:u}),(0,n.jsx)(o.N,{lazy:!0,className:d.tocCollapsibleContent,collapsed:s,children:(0,n.jsx)(i.A,{toc:e,minHeadingLevel:l,maxHeadingLevel:c})})]})}},32738:(e,t,l)=>{l.d(t,{A:()=>o});var n=l(62540);l(63696);var r=l(46733);function o({toc:e,minHeadingLevel:t,maxHeadingLevel:l}){return(0,n.jsx)("div",{className:"tableOfContentsInline_2sru",children:(0,n.jsx)(r.A,{toc:e,minHeadingLevel:t,maxHeadingLevel:l,className:"table-of-contents",linkClassName:null})})}},46733:(e,t,l)=>{l.d(t,{A:()=>u});var n=l(62540),r=l(63696),o=l(25436);function i(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{},n=Object.keys(l);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(l).filter(function(e){return Object.getOwnPropertyDescriptor(l,e).enumerable}))),n.forEach(function(t){var n;n=l[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function c(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);l.push.apply(l,n)}return l})(Object(t)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(t,l))}),e}function s(e){let t=e.getBoundingClientRect();return t.top===t.bottom?s(e.parentNode):t}var a=l(36372);let d=r.memo(function e({toc:t,className:l,linkClassName:r,isChild:o}){return t.length?(0,n.jsx)("ul",{className:o?void 0:l,children:t.map(t=>(0,n.jsxs)("li",{children:[(0,n.jsx)(a.A,{to:`#${t.id}`,className:null!=r?r:void 0,dangerouslySetInnerHTML:{__html:t.value}}),(0,n.jsx)(e,{isChild:!0,toc:t.children,className:l,linkClassName:r})]},t.id))}):null});function u(e){var{toc:t,className:l="table-of-contents table-of-contents__left-border",linkClassName:a="table-of-contents__link",linkActiveClassName:u,minHeadingLevel:v,maxHeadingLevel:b}=e,p=function(e,t){if(null==e)return{};var l,n,r=function(e,t){if(null==e)return{};var l,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)l=o[n],t.indexOf(l)>=0||(r[l]=e[l]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)l=o[n],!(t.indexOf(l)>=0)&&Object.prototype.propertyIsEnumerable.call(e,l)&&(r[l]=e[l])}return r}(e,["toc","className","linkClassName","linkActiveClassName","minHeadingLevel","maxHeadingLevel"]);let f=(0,o.p)(),h=null!=v?v:f.tableOfContents.minHeadingLevel,m=null!=b?b:f.tableOfContents.maxHeadingLevel,j=function({toc:e,minHeadingLevel:t,maxHeadingLevel:l}){return(0,r.useMemo)(()=>(function e({toc:t,minHeadingLevel:l,maxHeadingLevel:n}){return t.flatMap(t=>{let r=e({toc:t.children,minHeadingLevel:l,maxHeadingLevel:n});return t.level>=l&&t.level<=n?[c(i({},t),{children:r})]:r})})({toc:function(e){let t=e.map(e=>c(i({},e),{parentIndex:-1,children:[]})),l=Array(7).fill(-1);t.forEach((e,t)=>{let n=l.slice(2,e.level);e.parentIndex=Math.max(...n),l[e.level]=t});let n=[];return t.forEach(e=>{let{parentIndex:l}=e,r=function(e,t){if(null==e)return{};var l,n,r=function(e,t){if(null==e)return{};var l,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)l=o[n],t.indexOf(l)>=0||(r[l]=e[l]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)l=o[n],!(t.indexOf(l)>=0)&&Object.prototype.propertyIsEnumerable.call(e,l)&&(r[l]=e[l])}return r}(e,["parentIndex"]);l>=0?t[l].children.push(r):n.push(r)}),n}(e),minHeadingLevel:t,maxHeadingLevel:l}),[e,t,l])}({toc:t,minHeadingLevel:h,maxHeadingLevel:m});return!function(e){let t=(0,r.useRef)(void 0),l=function(){let e=(0,r.useRef)(0),{navbar:{hideOnScroll:t}}=(0,o.p)();return(0,r.useEffect)(()=>{e.current=t?0:document.querySelector(".navbar").clientHeight},[t]),e}();(0,r.useEffect)(()=>{if(!e)return()=>{};let{linkClassName:n,linkActiveClassName:r,minHeadingLevel:o,maxHeadingLevel:i}=e;function c(){let e=Array.from(document.getElementsByClassName(n)),c=function(e,{anchorTopOffset:t}){var l,n,r;let o=e.find(e=>s(e).top>=t);return o?(r=s(o)).top>0&&r.bottom<window.innerHeight/2?o:null!==(l=e[e.indexOf(o)-1])&&void 0!==l?l:null:null!==(n=e[e.length-1])&&void 0!==n?n:null}(function({minHeadingLevel:e,maxHeadingLevel:t}){let l=[];for(let n=e;n<=t;n+=1)l.push(`h${n}.anchor`);return Array.from(document.querySelectorAll(l.join()))}({minHeadingLevel:o,maxHeadingLevel:i}),{anchorTopOffset:l.current}),a=e.find(e=>c&&c.id===decodeURIComponent(e.href.substring(e.href.indexOf("#")+1)));e.forEach(e=>{e===a?(t.current&&t.current!==e&&t.current.classList.remove(r),e.classList.add(r),t.current=e):e.classList.remove(r)})}return document.addEventListener("scroll",c),document.addEventListener("resize",c),c(),()=>{document.removeEventListener("scroll",c),document.removeEventListener("resize",c)}},[e,l])}((0,r.useMemo)(()=>{if(a&&u)return{linkClassName:a,linkActiveClassName:u,minHeadingLevel:h,maxHeadingLevel:m}},[a,u,h,m])),(0,n.jsx)(d,function(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{},n=Object.keys(l);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(l).filter(function(e){return Object.getOwnPropertyDescriptor(l,e).enumerable}))),n.forEach(function(t){var n;n=l[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({toc:j,className:l,linkClassName:a},p))}},70361:(e,t,l)=>{l.d(t,{A:()=>c});var n=l(62540);l(63696);var r=l(11750);let o="dot_giz1",i="bar_rrRL";function c({children:e,minHeight:t,url:l="http://localhost:3000",style:c,bodyStyle:s}){var a,d;return(0,n.jsxs)("div",{className:"browserWindow_my1Q",style:(a=function(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{},n=Object.keys(l);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(l).filter(function(e){return Object.getOwnPropertyDescriptor(l,e).enumerable}))),n.forEach(function(t){var n;n=l[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},c),d=d={minHeight:t},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(d)):(function(e,t){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);l.push.apply(l,n)}return l})(Object(d)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(d,e))}),a),children:[(0,n.jsxs)("div",{className:"browserWindowHeader_jXSR",children:[(0,n.jsxs)("div",{className:"buttons_uHc7",children:[(0,n.jsx)("span",{className:o,style:{background:"#f25f58"}}),(0,n.jsx)("span",{className:o,style:{background:"#fbbe3c"}}),(0,n.jsx)("span",{className:o,style:{background:"#58cb42"}})]}),(0,n.jsx)("div",{className:(0,r.A)("browserWindowAddressBar_Pd8y","text--truncate"),children:l}),(0,n.jsx)("div",{className:"browserWindowMenuIcon_Vhuh",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:i}),(0,n.jsx)("span",{className:i}),(0,n.jsx)("span",{className:i})]})})]}),(0,n.jsx)("div",{className:"browserWindowBody_Idgs",style:s,children:e})]})}},53670:(e,t,l)=>{l.r(t),l.d(t,{assets:()=>u,contentTitle:()=>d,default:()=>p,frontMatter:()=>a,metadata:()=>n,toc:()=>v});let n=JSON.parse('{"id":"toc/toc-test-bad","title":"toc-test-bad","description":"Test the TOC behavior of a real-world MD doc with invalid headings","source":"@site/_dogfooding/_docs tests/toc/toc-test-bad.mdx","sourceDirName":"toc","slug":"/toc/toc-test-bad","permalink":"/tests/docs/toc/toc-test-bad","draft":false,"unlisted":false,"tags":[],"version":"current","lastUpdatedBy":"dependabot[bot]","lastUpdatedAt":1726738176000,"frontMatter":{"toc_min_heading_level":2,"toc_max_heading_level":6},"sidebar":"sidebar","previous":{"title":"toc-_-_","permalink":"/tests/docs/toc/toc-_-_"},"next":{"title":"toc-test-good","permalink":"/tests/docs/toc/toc-test-good"}}');var r=l(62540),o=l(43023),i=l(70361),c=l(32738),s=l(25592);let a={toc_min_heading_level:2,toc_max_heading_level:6},d=void 0,u={},v=[{value:"lvl 6",id:"lvl-6",level:6},{value:"lvl 5",id:"lvl-5",level:5},{value:"lvl 4",id:"lvl-4",level:4},{value:"lvl 5",id:"lvl-5-1",level:5},{value:"lvl 4",id:"lvl-4-1",level:4},{value:"lvl 3",id:"lvl-3",level:3},{value:"lvl 2",id:"lvl-2",level:2},{value:"lvl 2",id:"lvl-2-1",level:2},{value:"lvl 3",id:"lvl-3-1",level:3},{value:"lvl 4",id:"lvl-4-2",level:4},{value:"lvl 5",id:"lvl-5-2",level:5},{value:"lvl 6",id:"lvl-6-1",level:6},{value:"lvl 2",id:"lvl-2-2",level:2},{value:"lvl 3",id:"lvl-3-2",level:3},{value:"lvl 4",id:"lvl-4-3",level:4},{value:"lvl 5",id:"lvl-5-3",level:5},{value:"lvl 6",id:"lvl-6-2",level:6}];function b(e){let t={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",hr:"hr",p:"p",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.p,{children:"Test the TOC behavior of a real-world MD doc with invalid headings"}),"\n",(0,r.jsx)(t.hr,{}),"\n",(0,r.jsx)(t.p,{children:"BAD HEADINGS:"}),"\n",(0,r.jsx)(t.h6,{id:"lvl-6",children:"lvl 6"}),"\n",(0,r.jsx)(t.h5,{id:"lvl-5",children:"lvl 5"}),"\n",(0,r.jsx)(t.h4,{id:"lvl-4",children:"lvl 4"}),"\n",(0,r.jsx)(t.h5,{id:"lvl-5-1",children:"lvl 5"}),"\n",(0,r.jsx)(t.h4,{id:"lvl-4-1",children:"lvl 4"}),"\n",(0,r.jsx)(t.h3,{id:"lvl-3",children:"lvl 3"}),"\n",(0,r.jsx)(t.h2,{id:"lvl-2",children:"lvl 2"}),"\n",(0,r.jsx)(t.h1,{id:"lvl-1",children:"lvl 1"}),"\n",(0,r.jsx)(t.hr,{}),"\n",(0,r.jsx)(t.p,{children:"GOOD HEADINGS:"}),"\n",(0,r.jsx)(t.h2,{id:"lvl-2-1",children:"lvl 2"}),"\n",(0,r.jsx)(t.h3,{id:"lvl-3-1",children:"lvl 3"}),"\n",(0,r.jsx)(t.h4,{id:"lvl-4-2",children:"lvl 4"}),"\n",(0,r.jsx)(t.h5,{id:"lvl-5-2",children:"lvl 5"}),"\n",(0,r.jsx)(t.h6,{id:"lvl-6-1",children:"lvl 6"}),"\n",(0,r.jsx)(t.h2,{id:"lvl-2-2",children:"lvl 2"}),"\n",(0,r.jsx)(t.h3,{id:"lvl-3-2",children:"lvl 3"}),"\n",(0,r.jsx)(t.h4,{id:"lvl-4-3",children:"lvl 4"}),"\n",(0,r.jsx)(t.h5,{id:"lvl-5-3",children:"lvl 5"}),"\n",(0,r.jsx)(t.h6,{id:"lvl-6-2",children:"lvl 6"}),"\n",(0,r.jsx)(t.hr,{}),"\n",(0,r.jsx)(t.p,{children:"INLINE:"}),"\n","\n","\n",(0,r.jsx)(i.A,{children:(0,r.jsx)(c.A,{toc:v,minHeadingLevel:2,maxHeadingLevel:6})}),"\n",(0,r.jsx)(t.hr,{}),"\n",(0,r.jsx)(t.p,{children:"COLLAPSIBLE:"}),"\n","\n",(0,r.jsx)(i.A,{children:(0,r.jsx)(s.A,{toc:v,minHeadingLevel:2,maxHeadingLevel:6})})]})}function p(e={}){let{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(b,{...e})}):b(e)}p.displayName="MDXContent(_dogfooding/_docs tests/toc/toc-test-bad.mdx)"},43023:(e,t,l)=>{l.d(t,{R:()=>i,x:()=>c});var n=l(63696);let r={},o=n.createContext(r);function i(e){let t=n.useContext(o);return n.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]); |