mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-01 19:27:48 +02:00
1 line
No EOL
9.1 KiB
JavaScript
1 line
No EOL
9.1 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["77235"],{37793:function(e,l,t){t.r(l),t.d(l,{metadata:()=>n,contentTitle:()=>c,default:()=>m,assets:()=>v,toc:()=>u,frontMatter:()=>d});var 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":"S\xe9bastien Lorber","lastUpdatedAt":1729847735000,"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"}}'),s=t("24246"),i=t("80980"),o=t("14522"),a=t("78596"),r=t("57589");let d={toc_min_heading_level:2,toc_max_heading_level:6},c=void 0,v={},u=[{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 h(e){let l={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",hr:"hr",p:"p",...(0,i.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.p,{children:"Test the TOC behavior of a real-world MD doc with invalid headings"}),"\n",(0,s.jsx)(l.hr,{}),"\n",(0,s.jsx)(l.p,{children:"BAD HEADINGS:"}),"\n",(0,s.jsx)(l.h6,{id:"lvl-6",children:"lvl 6"}),"\n",(0,s.jsx)(l.h5,{id:"lvl-5",children:"lvl 5"}),"\n",(0,s.jsx)(l.h4,{id:"lvl-4",children:"lvl 4"}),"\n",(0,s.jsx)(l.h5,{id:"lvl-5-1",children:"lvl 5"}),"\n",(0,s.jsx)(l.h4,{id:"lvl-4-1",children:"lvl 4"}),"\n",(0,s.jsx)(l.h3,{id:"lvl-3",children:"lvl 3"}),"\n",(0,s.jsx)(l.h2,{id:"lvl-2",children:"lvl 2"}),"\n",(0,s.jsx)(l.h1,{id:"lvl-1",children:"lvl 1"}),"\n",(0,s.jsx)(l.hr,{}),"\n",(0,s.jsx)(l.p,{children:"GOOD HEADINGS:"}),"\n",(0,s.jsx)(l.h2,{id:"lvl-2-1",children:"lvl 2"}),"\n",(0,s.jsx)(l.h3,{id:"lvl-3-1",children:"lvl 3"}),"\n",(0,s.jsx)(l.h4,{id:"lvl-4-2",children:"lvl 4"}),"\n",(0,s.jsx)(l.h5,{id:"lvl-5-2",children:"lvl 5"}),"\n",(0,s.jsx)(l.h6,{id:"lvl-6-1",children:"lvl 6"}),"\n",(0,s.jsx)(l.h2,{id:"lvl-2-2",children:"lvl 2"}),"\n",(0,s.jsx)(l.h3,{id:"lvl-3-2",children:"lvl 3"}),"\n",(0,s.jsx)(l.h4,{id:"lvl-4-3",children:"lvl 4"}),"\n",(0,s.jsx)(l.h5,{id:"lvl-5-3",children:"lvl 5"}),"\n",(0,s.jsx)(l.h6,{id:"lvl-6-2",children:"lvl 6"}),"\n",(0,s.jsx)(l.hr,{}),"\n",(0,s.jsx)(l.p,{children:"INLINE:"}),"\n","\n","\n",(0,s.jsx)(o.Z,{children:(0,s.jsx)(a.Z,{toc:u,minHeadingLevel:2,maxHeadingLevel:6})}),"\n",(0,s.jsx)(l.hr,{}),"\n",(0,s.jsx)(l.p,{children:"COLLAPSIBLE:"}),"\n","\n",(0,s.jsx)(o.Z,{children:(0,s.jsx)(r.Z,{toc:u,minHeadingLevel:2,maxHeadingLevel:6})})]})}function m(e={}){let{wrapper:l}={...(0,i.a)(),...e.components};return l?(0,s.jsx)(l,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}m.displayName="MDXContent(_dogfooding/_docs tests/toc/toc-test-bad.mdx)"},57589:function(e,l,t){t.d(l,{Z:()=>v});var n=t("24246");t("27378");var s=t("90496"),i=t("97812"),o=t("89477"),a=t("77827");let r={tocCollapsibleButton:"tocCollapsibleButton_IbtT",tocCollapsibleButtonExpanded:"tocCollapsibleButtonExpanded_Nor3"};function d(e){let{collapsed:l,...t}=e;return(0,n.jsx)("button",{type:"button",...t,className:(0,s.Z)("clean-btn",r.tocCollapsibleButton,!l&&r.tocCollapsibleButtonExpanded,t.className),children:(0,n.jsx)(a.Z,{id:"theme.TOCCollapsible.toggleButtonLabel",description:"The label used by the button on the collapsible TOC component",children:"On this page"})})}let c={tocCollapsible:"tocCollapsible_BEWm",tocCollapsibleContent:"tocCollapsibleContent_FG8F",tocCollapsibleExpanded:"tocCollapsibleExpanded_FzA_"};function v(e){let{toc:l,className:t,minHeadingLevel:a,maxHeadingLevel:r}=e,{collapsed:v,toggleCollapsed:u}=(0,i.u)({initialState:!0});return(0,n.jsxs)("div",{className:(0,s.Z)(c.tocCollapsible,!v&&c.tocCollapsibleExpanded,t),children:[(0,n.jsx)(d,{collapsed:v,onClick:u}),(0,n.jsx)(i.z,{lazy:!0,className:c.tocCollapsibleContent,collapsed:v,children:(0,n.jsx)(o.Z,{toc:l,minHeadingLevel:a,maxHeadingLevel:r})})]})}},78596:function(e,l,t){t.d(l,{Z:()=>o});var n=t("24246");t("27378");var s=t("89477");let i="tableOfContentsInline_2sru";function o(e){let{toc:l,minHeadingLevel:t,maxHeadingLevel:o}=e;return(0,n.jsx)("div",{className:i,children:(0,n.jsx)(s.Z,{toc:l,minHeadingLevel:t,maxHeadingLevel:o,className:"table-of-contents",linkClassName:null})})}},89477:function(e,l,t){t.d(l,{Z:()=>d});var n=t("24246"),s=t("27378"),i=t("26378");function o(e){let l=e.getBoundingClientRect();return l.top===l.bottom?o(e.parentNode):l}var a=t("35363");let r=s.memo(function e(l){let{toc:t,className:s,linkClassName:i,isChild:o}=l;return t.length?(0,n.jsx)("ul",{className:o?void 0:s,children:t.map(l=>(0,n.jsxs)("li",{children:[(0,n.jsx)(a.Z,{to:`#${l.id}`,className:i??void 0,dangerouslySetInnerHTML:{__html:l.value}}),(0,n.jsx)(e,{isChild:!0,toc:l.children,className:s,linkClassName:i})]},l.id))}):null});function d(e){let{toc:l,className:t="table-of-contents table-of-contents__left-border",linkClassName:a="table-of-contents__link",linkActiveClassName:d,minHeadingLevel:c,maxHeadingLevel:v,...u}=e,h=(0,i.L)(),m=c??h.tableOfContents.minHeadingLevel,x=v??h.tableOfContents.maxHeadingLevel,f=function(e){let{toc:l,minHeadingLevel:t,maxHeadingLevel:n}=e;return(0,s.useMemo)(()=>(function e(l){let{toc:t,minHeadingLevel:n,maxHeadingLevel:s}=l;return t.flatMap(l=>{var t;let i=e({toc:l.children,minHeadingLevel:n,maxHeadingLevel:s});return(t=l).level>=n&&t.level<=s?[{...l,children:i}]:i})})({toc:function(e){let l=e.map(e=>({...e,parentIndex:-1,children:[]})),t=Array(7).fill(-1);l.forEach((e,l)=>{let n=t.slice(2,e.level);e.parentIndex=Math.max(...n),t[e.level]=l});let n=[];return l.forEach(e=>{let{parentIndex:t,...s}=e;t>=0?l[t].children.push(s):n.push(s)}),n}(l),minHeadingLevel:t,maxHeadingLevel:n}),[l,t,n])}({toc:l,minHeadingLevel:m,maxHeadingLevel:x});return!function(e){let l=(0,s.useRef)(void 0),t=function(){let e=(0,s.useRef)(0),{navbar:{hideOnScroll:l}}=(0,i.L)();return(0,s.useEffect)(()=>{e.current=l?0:document.querySelector(".navbar").clientHeight},[l]),e}();(0,s.useEffect)(()=>{if(!e)return()=>{};let{linkClassName:n,linkActiveClassName:s,minHeadingLevel:i,maxHeadingLevel:a}=e;function r(){var e;let r=(e=n,Array.from(document.getElementsByClassName(e))),d=function(e,l){let{anchorTopOffset:t}=l,n=e.find(e=>o(e).top>=t);if(n){var s;return(s=o(n)).top>0&&s.bottom<window.innerHeight/2?n:e[e.indexOf(n)-1]??null}return e[e.length-1]??null}(function(e){let{minHeadingLevel:l,maxHeadingLevel:t}=e,n=[];for(let e=l;e<=t;e+=1)n.push(`h${e}.anchor`);return Array.from(document.querySelectorAll(n.join()))}({minHeadingLevel:i,maxHeadingLevel:a}),{anchorTopOffset:t.current}),c=r.find(e=>{var l;return d&&d.id===decodeURIComponent((l=e).href.substring(l.href.indexOf("#")+1))});r.forEach(e=>{var t;t=e,e===c?(l.current&&l.current!==t&&l.current.classList.remove(s),t.classList.add(s),l.current=t):t.classList.remove(s)})}return document.addEventListener("scroll",r),document.addEventListener("resize",r),r(),()=>{document.removeEventListener("scroll",r),document.removeEventListener("resize",r)}},[e,t])}((0,s.useMemo)(()=>{if(a&&d)return{linkClassName:a,linkActiveClassName:d,minHeadingLevel:m,maxHeadingLevel:x}},[a,d,m,x])),(0,n.jsx)(r,{toc:f,className:t,linkClassName:a,...u})}},14522:function(e,l,t){t.d(l,{Z:()=>h});var n=t("24246");t("27378");var s=t("90496");let i="browserWindow_my1Q",o="browserWindowHeader_jXSR",a="buttons_uHc7",r="browserWindowAddressBar_Pd8y",d="dot_giz1",c="browserWindowMenuIcon_Vhuh",v="bar_rrRL",u="browserWindowBody_Idgs";function h(e){let{children:l,minHeight:t,url:h="http://localhost:3000",style:m,bodyStyle:x}=e;return(0,n.jsxs)("div",{className:i,style:{...m,minHeight:t},children:[(0,n.jsxs)("div",{className:o,children:[(0,n.jsxs)("div",{className:a,children:[(0,n.jsx)("span",{className:d,style:{background:"#f25f58"}}),(0,n.jsx)("span",{className:d,style:{background:"#fbbe3c"}}),(0,n.jsx)("span",{className:d,style:{background:"#58cb42"}})]}),(0,n.jsx)("div",{className:(0,s.Z)(r,"text--truncate"),children:h}),(0,n.jsx)("div",{className:c,children:(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:v}),(0,n.jsx)("span",{className:v}),(0,n.jsx)("span",{className:v})]})})]}),(0,n.jsx)("div",{className:u,style:x,children:l})]})}},80980:function(e,l,t){t.d(l,{Z:function(){return a},a:function(){return o}});var n=t(27378);let s={},i=n.createContext(s);function o(e){let l=n.useContext(i);return n.useMemo(function(){return"function"==typeof e?e(l):{...l,...e}},[l,e])}function a(e){let l;return l=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),n.createElement(i.Provider,{value:l},e.children)}}}]); |