mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-24 22:46:57 +02:00
1 line
No EOL
49 KiB
JavaScript
1 line
No EOL
49 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[76581],{61132:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(24246),o=(n(27378),n(40624));const s={tabItem:"tabItem_pnkT"};function c({children:e,hidden:t,className:n}){return(0,r.jsx)("div",{role:"tabpanel",className:(0,o.Z)(s.tabItem,n),hidden:t,children:e})}},97555:(e,t,n)=>{n.d(t,{Z:()=>N});var r=n(24246),o=n(27378),s=n(40624),c=n(75527),l=n(3620),i=n(44479),a=n(62821),u=n(52196),d=n(53589);function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function p(e){var t,n;return null!==(n=null===(t=o.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,o.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new 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.`)})))||void 0===t?void 0:t.filter(Boolean))&&void 0!==n?n:[]}function g(e){const{values:t,children:n}=e;return(0,o.useMemo)((()=>{const e=null!=t?t:function(e){return p(e).map((({props:{value:e,label:t,attributes:n,default:r}})=>({value:e,label:t,attributes:n,default:r})))}(n);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function m({value:e,tabValues:t}){return t.some((t=>t.value===e))}function j({queryString:e=!1,groupId:t}){const n=(0,l.k6)(),r=function({queryString:e=!1,groupId:t}){if("string"==typeof e)return e;if(!1===e)return null;if(!0===e&&!t)throw new 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 null!=t?t:null}({queryString:e,groupId:t}),s=(0,a._X)(r),c=(0,o.useCallback)((e=>{if(!r)return;const t=new URLSearchParams(n.location.search);t.set(r,e),n.replace(b(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){h(e,t,n[t])}))}return e}({},n.location),{search:t.toString()}))}),[r,n]);return[s,c]}function f(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,s=g(e),[c,l]=(0,o.useState)((()=>function({defaultValue:e,tabValues:t}){if(0===t.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(e){if(!m({value:e,tabValues:t}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${e}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return e}var n;const r=null!==(n=t.find((e=>e.default)))&&void 0!==n?n:t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:s}))),[a,u]=j({queryString:n,groupId:r}),[h,b]=function({groupId:e}){const t=function(e){return e?`docusaurus.tab.${e}`:null}(e),[n,r]=(0,d.Nk)(t);return[n,(0,o.useCallback)((e=>{t&&r.set(e)}),[t,r])]}({groupId:r}),p=(()=>{const e=null!=a?a:h;return m({value:e,tabValues:s})?e:null})();(0,i.Z)((()=>{p&&l(p)}),[p]);return{selectedValue:c,selectValue:(0,o.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),b(e)}),[u,b,s]),tabValues:s}}var y=n(29088);const O={tabList:"tabList_Qoir",tabItem:"tabItem_AQgk"};function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){x(e,t,n[t])}))}return e}function w(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function k({className:e,block:t,selectedValue:n,selectValue:o,tabValues:l}){const i=[],{blockElementScrollPositionUntilNextRender:a}=(0,c.o5)(),u=e=>{const t=e.currentTarget,r=i.indexOf(t),s=l[r].value;s!==n&&(a(t),o(s))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const r=i.indexOf(e.currentTarget)+1;var n;t=null!==(n=i[r])&&void 0!==n?n:i[0];break}case"ArrowLeft":{const n=i.indexOf(e.currentTarget)-1;var r;t=null!==(r=i[n])&&void 0!==r?r:i[i.length-1];break}}null==t||t.focus()};return(0,r.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":t},e),children:l.map((({value:e,label:t,attributes:o})=>(0,r.jsx)("li",w(v({role:"tab",tabIndex:n===e?0:-1,"aria-selected":n===e,ref:e=>i.push(e),onKeyDown:d,onClick:u},o),{className:(0,s.Z)("tabs__item",O.tabItem,null==o?void 0:o.className,{"tabs__item--active":n===e}),children:null!=t?t:e}),e)))})}function T({lazy:e,children:t,selectedValue:n}){const c=(Array.isArray(t)?t:[t]).filter(Boolean);if(e){const e=c.find((e=>e.props.value===n));return e?(0,o.cloneElement)(e,{className:(0,s.Z)("margin-top--md",e.props.className)}):null}return(0,r.jsx)("div",{className:"margin-top--md",children:c.map(((e,t)=>(0,o.cloneElement)(e,{key:t,hidden:e.props.value!==n})))})}function P(e){const t=f(e);return(0,r.jsxs)("div",{className:(0,s.Z)("tabs-container",O.tabList),children:[(0,r.jsx)(k,v({},t,e)),(0,r.jsx)(T,v({},t,e))]})}function N(e){const t=(0,y.Z)();return(0,r.jsx)(P,w(v({},e),{children:p(e.children)}),String(t))}},94544:(e,t,n)=>{n.d(t,{Z:()=>s});var r=n(24246),o=(n(27378),n(29088));function s({children:e,fallback:t}){return(0,o.Z)()?(0,r.jsx)(r.Fragment,{children:null==e?void 0:e()}):null!=t?t:null}},6698:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(24246),o=(n(27378),n(40624));const s={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"};function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){c(e,t,n[t])}))}return e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function a({children:e,minHeight:t,url:n="http://localhost:3000",style:c,bodyStyle:a}){return(0,r.jsxs)("div",{className:s.browserWindow,style:i(l({},c),{minHeight:t}),children:[(0,r.jsxs)("div",{className:s.browserWindowHeader,children:[(0,r.jsxs)("div",{className:s.buttons,children:[(0,r.jsx)("span",{className:s.dot,style:{background:"#f25f58"}}),(0,r.jsx)("span",{className:s.dot,style:{background:"#fbbe3c"}}),(0,r.jsx)("span",{className:s.dot,style:{background:"#58cb42"}})]}),(0,r.jsx)("div",{className:(0,o.Z)(s.browserWindowAddressBar,"text--truncate"),children:n}),(0,r.jsx)("div",{className:s.browserWindowMenuIcon,children:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:s.bar}),(0,r.jsx)("span",{className:s.bar}),(0,r.jsx)("span",{className:s.bar})]})})]}),(0,r.jsx)("div",{className:s.browserWindowBody,style:a,children:e})]})}},38112:(e,t,n)=>{n.d(t,{Z:()=>Ze});var r={};n.r(r),n.d(r,{ButtonExample:()=>_});var o=n(24246),s=n(27378),c=n(40624),l=n(29088),i=n(32711),a=n(36712),u=n(4423),d=n(94544),h=n(30691),b=n(78844),p=n(73919);function g(){const{prism:e}=(0,p.L)(),{colorMode:t}=(0,b.I)(),n=e.theme,r=e.darkTheme||n;return"dark"===t?r:n}var m=n(88941);const j={playgroundContainer:"playgroundContainer_6Ior",playgroundHeader:"playgroundHeader_Tvsk",playgroundEditor:"playgroundEditor_TySg",playgroundPreview:"playgroundPreview_mApW"};function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){f(e,t,n[t])}))}return e}function O(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function x(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function v({children:e}){return(0,o.jsx)("div",{className:(0,c.Z)(j.playgroundHeader),children:e})}function w(){return(0,o.jsx)("div",{children:"Loading..."})}function k(){return(0,o.jsx)(d.Z,{fallback:(0,o.jsx)(w,{}),children:()=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(m.Z,{fallback:e=>(0,o.jsx)(h.Ac,y({},e)),children:(0,o.jsx)(i.i5,{})}),(0,o.jsx)(i.IF,{})]})})}function T(){return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(v,{children:(0,o.jsx)(a.Z,{id:"theme.Playground.result",description:"The result label of the live codeblocks",children:"Result"})}),(0,o.jsx)("div",{className:j.playgroundPreview,children:(0,o.jsx)(k,{})})]})}function P(){const e=(0,l.Z)();return(0,o.jsx)(i.uz,{className:j.playgroundEditor},String(e))}function N(){return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(v,{children:(0,o.jsx)(a.Z,{id:"theme.Playground.liveEditor",description:"The live editor label of the live codeblocks",children:"Live Editor"})}),(0,o.jsx)(P,{})]})}const S=e=>`${e};`;function E(e){var t,{children:n,transformCode:r}=e,s=x(e,["children","transformCode"]);const{siteConfig:{themeConfig:c}}=(0,u.Z)(),{liveCodeBlock:{playgroundPosition:l}}=c,a=g();var d;const h=null!==(d=null===(t=s.metastring)||void 0===t?void 0:t.includes("noInline"))&&void 0!==d&&d;return(0,o.jsx)("div",{className:j.playgroundContainer,children:(0,o.jsx)(i.nu,O(y({code:null==n?void 0:n.replace(/\n$/,""),noInline:h,transformCode:null!=r?r:S,theme:a},s),{children:"top"===l?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(T,{}),(0,o.jsx)(N,{})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(N,{}),(0,o.jsx)(T,{})]})}))})}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){D(e,t,n[t])}))}return e}function B(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function _(e){return(0,o.jsx)("button",B(C({type:"button"},e),{style:C({backgroundColor:"white",color:"black",border:"solid red",borderRadius:20,padding:10,cursor:"pointer"},e.style)}))}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const I=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){L(e,t,n[t])}))}return e}({React:s},s,r);var Z,$,A=n(89583),H=n(6324),W=n.n(H);function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const V=RegExp("title=(?<quote>[\"'])(?<title>.*?)\\1"),M=RegExp("\\{(?<range>[\\d,-]+)\\}"),F={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},bash:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}},q=(z=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){R(e,t,n[t])}))}return e}({},F),U=null!=(U={lua:{start:"--",end:""},wasm:{start:"\\;\\;",end:""},tex:{start:"%",end:""},vb:{start:"['\u2018\u2019]",end:""},vbnet:{start:"(?:_\\s*)?['\u2018\u2019]",end:""},rem:{start:"[Rr][Ee][Mm]\\b",end:""},f90:{start:"!",end:""},ml:{start:"\\(\\*",end:"\\*\\)"},cobol:{start:"\\*>",end:""}})?U:{},Object.getOwnPropertyDescriptors?Object.defineProperties(z,Object.getOwnPropertyDescriptors(U)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(U)).forEach((function(e){Object.defineProperty(z,e,Object.getOwnPropertyDescriptor(U,e))})),z);var z,U;const G=Object.keys(F);function X(e,t){const n=e.map((e=>{const{start:n,end:r}=q[e];return`(?:${n}\\s*(${t.flatMap((e=>{var t,n;return[e.line,null===(t=e.block)||void 0===t?void 0:t.start,null===(n=e.block)||void 0===n?void 0:n.end].filter(Boolean)})).join("|")})\\s*${r})`})).join("|");return new RegExp(`^\\s*(?:${n})\\s*$`)}function Q(e,t){let n=e.replace(/\n$/,"");const{language:r,magicComments:o,metastring:s}=t;if(s&&M.test(s)){const e=s.match(M).groups.range;if(0===o.length)throw new Error(`A highlight range has been given in code block's metastring (\`\`\` ${s}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);const t=o[0].className,r=W()(e).filter((e=>e>0)).map((e=>[e-1,[t]]));return{lineClassNames:Object.fromEntries(r),code:n}}if(void 0===r)return{lineClassNames:{},code:n};const c=function(e,t){switch(e){case"js":case"javascript":case"ts":case"typescript":return X(["js","jsBlock"],t);case"jsx":case"tsx":return X(["js","jsBlock","jsx"],t);case"html":return X(["js","jsBlock","html"],t);case"python":case"py":case"bash":return X(["bash"],t);case"markdown":case"md":return X(["html","jsx","bash"],t);case"tex":case"latex":case"matlab":return X(["tex"],t);case"lua":case"haskell":case"sql":return X(["lua"],t);case"wasm":return X(["wasm"],t);case"vb":case"vba":case"visual-basic":return X(["vb","rem"],t);case"vbnet":return X(["vbnet","rem"],t);case"batch":return X(["rem"],t);case"basic":return X(["rem","f90"],t);case"fsharp":return X(["js","ml"],t);case"ocaml":case"sml":return X(["ml"],t);case"fortran":return X(["f90"],t);case"cobol":return X(["cobol"],t);default:return X(G,t)}}(r,o),l=n.split("\n"),i=Object.fromEntries(o.map((e=>[e.className,{start:0,range:""}]))),a=Object.fromEntries(o.filter((e=>e.line)).map((({className:e,line:t})=>[t,e]))),u=Object.fromEntries(o.filter((e=>e.block)).map((({className:e,block:t})=>[t.start,e]))),d=Object.fromEntries(o.filter((e=>e.block)).map((({className:e,block:t})=>[t.end,e])));for(let b=0;b<l.length;){const e=l[b].match(c);if(!e){b+=1;continue}const t=e.slice(1).find((e=>void 0!==e));a[t]?i[a[t]].range+=`${b},`:u[t]?i[u[t]].start=b:d[t]&&(i[d[t]].range+=`${i[d[t]].start}-${b-1},`),l.splice(b,1)}n=l.join("\n");const h={};return Object.entries(i).forEach((([e,{range:t}])=>{W()(t).forEach((t=>{var n;null!==(n=(Z=h)[$=t])&&void 0!==n||(Z[$]=[]),h[t].push(e)}))})),{lineClassNames:h,code:n}}const Y={codeBlockContainer:"codeBlockContainer_jDV4"};function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function ee(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function te(e){var{as:t}=e,n=ee(e,["as"]);const r=function(e){const t={color:"--prism-color",backgroundColor:"--prism-background-color"},n={};return Object.entries(e.plain).forEach((([e,r])=>{const o=t[e];o&&"string"==typeof r&&(n[o]=r)})),n}(g());return(0,o.jsx)(t,K(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){J(e,t,n[t])}))}return e}({},n),{style:r,className:(0,c.Z)(n.className,Y.codeBlockContainer,A.k.common.codeBlock)}))}const ne={codeBlockContent:"codeBlockContent_vx7S",codeBlockTitle:"codeBlockTitle_bdru",codeBlock:"codeBlock_Gebt",codeBlockStandalone:"codeBlockStandalone_i_cY",codeBlockLines:"codeBlockLines_FJaf",codeBlockLinesWithNumbering:"codeBlockLinesWithNumbering_FU9Q",buttonGroup:"buttonGroup_cUGO"};function re({children:e,className:t}){return(0,o.jsx)(te,{as:"pre",tabIndex:0,className:(0,c.Z)(ne.codeBlockStandalone,"thin-scrollbar",t),children:(0,o.jsx)("code",{className:ne.codeBlockLines,children:e})})}var oe=n(51114);const se={attributes:!0,characterData:!0,childList:!0,subtree:!0};function ce(e,t){const[n,r]=(0,s.useState)(),o=(0,s.useCallback)((()=>{var t;r(null===(t=e.current)||void 0===t?void 0:t.closest("[role=tabpanel][hidden]"))}),[e,r]);(0,s.useEffect)((()=>{o()}),[o]),function(e,t,n=se){const r=(0,oe.zX)(t),o=(0,oe.Ql)(n);(0,s.useEffect)((()=>{const t=new MutationObserver(r);return e&&t.observe(e,o),()=>t.disconnect()}),[e,r,o])}(n,(e=>{e.forEach((e=>{"attributes"===e.type&&"hidden"===e.attributeName&&(t(),o())}))}),{attributes:!0,characterData:!1,childList:!1,subtree:!1})}var le=n(26101);const ie={codeLine:"codeLine_qRmp",codeLineNumber:"codeLineNumber_dS_J",codeLineContent:"codeLineContent_XF5l"};function ae(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ae(e,t,n[t])}))}return e}function de(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function he({line:e,classNames:t,showLineNumbers:n,getLineProps:r,getTokenProps:s}){1===e.length&&"\n"===e[0].content&&(e[0].content="");const l=r({line:e,className:(0,c.Z)(t,n&&ie.codeLine)}),i=e.map(((e,t)=>(0,o.jsx)("span",ue({},s({token:e})),t)));return(0,o.jsxs)("span",de(ue({},l),{children:[n?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:ie.codeLineNumber}),(0,o.jsx)("span",{className:ie.codeLineContent,children:i})]}):i,(0,o.jsx)("br",{})]}))}var be=n(34370);function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ge(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function me(e){return(0,o.jsx)("svg",ge(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){pe(e,t,n[t])}))}return e}({viewBox:"0 0 24 24"},e),{children:(0,o.jsx)("path",{fill:"currentColor",d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"})}))}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fe(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function ye(e){return(0,o.jsx)("svg",fe(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){je(e,t,n[t])}))}return e}({viewBox:"0 0 24 24"},e),{children:(0,o.jsx)("path",{fill:"currentColor",d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})}))}const Oe={copyButtonCopied:"copyButtonCopied_OkN_",copyButtonIcons:"copyButtonIcons_OqsO",copyButtonIcon:"copyButtonIcon_PgCn",copyButtonSuccessIcon:"copyButtonSuccessIcon_bsQG"};function xe({code:e,className:t}){const[n,r]=(0,s.useState)(!1),l=(0,s.useRef)(void 0),i=(0,s.useCallback)((()=>{(0,be.Z)(e),r(!0),l.current=window.setTimeout((()=>{r(!1)}),1e3)}),[e]);return(0,s.useEffect)((()=>()=>window.clearTimeout(l.current)),[]),(0,o.jsx)("button",{type:"button","aria-label":n?(0,a.I)({id:"theme.CodeBlock.copied",message:"Copied",description:"The copied button label on code blocks"}):(0,a.I)({id:"theme.CodeBlock.copyButtonAriaLabel",message:"Copy code to clipboard",description:"The ARIA label for copy code blocks button"}),title:(0,a.I)({id:"theme.CodeBlock.copy",message:"Copy",description:"The copy button label on code blocks"}),className:(0,c.Z)("clean-btn",t,Oe.copyButton,n&&Oe.copyButtonCopied),onClick:i,children:(0,o.jsxs)("span",{className:Oe.copyButtonIcons,"aria-hidden":"true",children:[(0,o.jsx)(me,{className:Oe.copyButtonIcon}),(0,o.jsx)(ye,{className:Oe.copyButtonSuccessIcon})]})})}function ve(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function we(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function ke(e){return(0,o.jsx)("svg",we(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ve(e,t,n[t])}))}return e}({viewBox:"0 0 24 24"},e),{children:(0,o.jsx)("path",{fill:"currentColor",d:"M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"})}))}const Te={wordWrapButtonIcon:"wordWrapButtonIcon_MQXS",wordWrapButtonEnabled:"wordWrapButtonEnabled_TBIH"};function Pe({className:e,onClick:t,isEnabled:n}){const r=(0,a.I)({id:"theme.CodeBlock.wordWrapToggle",message:"Toggle word wrap",description:"The title attribute for toggle word wrapping button of code block lines"});return(0,o.jsx)("button",{type:"button",onClick:t,className:(0,c.Z)("clean-btn",e,n&&Te.wordWrapButtonEnabled),"aria-label":r,title:r,children:(0,o.jsx)(ke,{className:Te.wordWrapButtonIcon,"aria-hidden":"true"})})}function Ne({children:e,className:t="",metastring:n,title:r,showLineNumbers:l,language:i}){const{prism:{defaultLanguage:a,magicComments:u}}=(0,p.L)();var d;const h=function(e){return null==e?void 0:e.toLowerCase()}(null!==(d=null!=i?i:function(e){const t=e.split(" ").find((e=>e.startsWith("language-")));return null==t?void 0:t.replace(/language-/,"")}(t))&&void 0!==d?d:a),b=g(),m=function(){const[e,t]=(0,s.useState)(!1),[n,r]=(0,s.useState)(!1),o=(0,s.useRef)(null),c=(0,s.useCallback)((()=>{const n=o.current.querySelector("code");e?n.removeAttribute("style"):(n.style.whiteSpace="pre-wrap",n.style.overflowWrap="anywhere"),t((e=>!e))}),[o,e]),l=(0,s.useCallback)((()=>{const{scrollWidth:e,clientWidth:t}=o.current,n=e>t||o.current.querySelector("code").hasAttribute("style");r(n)}),[o]);return ce(o,l),(0,s.useEffect)((()=>{l()}),[e,l]),(0,s.useEffect)((()=>(window.addEventListener("resize",l,{passive:!0}),()=>{window.removeEventListener("resize",l)})),[l]),{codeBlockRef:o,isEnabled:e,isCodeScrollable:n,toggle:c}}(),j=function(e){var t,n;return null!==(n=null===(t=null==e?void 0:e.match(V))||void 0===t?void 0:t.groups.title)&&void 0!==n?n:""}(n)||r,{lineClassNames:f,code:y}=Q(e,{metastring:n,language:h,magicComments:u}),O=null!=l?l:function(e){return Boolean(null==e?void 0:e.includes("showLineNumbers"))}(n);return(0,o.jsxs)(te,{as:"div",className:(0,c.Z)(t,h&&!t.includes(`language-${h}`)&&`language-${h}`),children:[j&&(0,o.jsx)("div",{className:ne.codeBlockTitle,children:j}),(0,o.jsxs)("div",{className:ne.codeBlockContent,children:[(0,o.jsx)(le.y$,{theme:b,code:y,language:null!=h?h:"text",children:({className:e,style:t,tokens:n,getLineProps:r,getTokenProps:s})=>(0,o.jsx)("pre",{tabIndex:0,ref:m.codeBlockRef,className:(0,c.Z)(e,ne.codeBlock,"thin-scrollbar"),style:t,children:(0,o.jsx)("code",{className:(0,c.Z)(ne.codeBlockLines,O&&ne.codeBlockLinesWithNumbering),children:n.map(((e,t)=>(0,o.jsx)(he,{line:e,getLineProps:r,getTokenProps:s,classNames:f[t],showLineNumbers:O},t)))})})}),(0,o.jsxs)("div",{className:ne.buttonGroup,children:[(m.isEnabled||m.isCodeScrollable)&&(0,o.jsx)(Pe,{className:ne.codeButton,onClick:()=>m.toggle(),isEnabled:m.isEnabled}),(0,o.jsx)(xe,{className:ne.codeButton,code:y})]})]})]})}function Se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function De(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ce(e,t,n[t])}))}return e}const _e=(Le=function(e){var{children:t}=e,n=De(e,["children"]);const r=(0,l.Z)(),c=function(e){return s.Children.toArray(e).some((e=>(0,s.isValidElement)(e)))?e:Array.isArray(e)?e.join(""):e}(t),i="string"==typeof c?Ne:re;return(0,o.jsx)(i,Ee(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Se(e,t,n[t])}))}return e}({},n),{children:c}),String(r))},function(e){return e.live?(0,o.jsx)(E,Be({scope:I},e)):(0,o.jsx)(Le,Be({},e))});var Le;function Ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ze(e){return(0,o.jsx)(_e,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ie(e,t,n[t])}))}return e}({},e))}},417:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>h,contentTitle:()=>u,default:()=>g,frontMatter:()=>a,metadata:()=>d,toc:()=>b});var r=n(24246),o=n(71670),s=n(38112),c=n(6698),l=n(97555),i=n(61132);const a={},u="Code block tests",d={type:"mdx",permalink:"/tests/pages/code-block-tests",source:"@site/_dogfooding/_pages tests/code-block-tests.mdx",title:"Code block tests",description:"This test page is quite outdated: MDX v2 lowercase tags are not substituted anymore in the same way as they were in v1.",frontMatter:{},lastUpdatedBy:"Tatsunori Uchino",lastUpdatedAt:1718970228e3,editUrl:"https://github.com/facebook/docusaurus/edit/main/website/_dogfooding/_pages tests/code-block-tests.mdx",unlisted:!1},h={},b=[{value:"Code block prism language tests",id:"code-block-prism-language-tests",level:2},{value:"<code>pre</code>",id:"pre",level:2},{value:"<code>pre > string</code>",id:"pre--string",level:3},{value:"<code>pre > string[]</code>",id:"pre--string-1",level:3},{value:"<code>pre > element</code>",id:"pre--element",level:3},{value:"<code>pre > element[]</code>",id:"pre--element-1",level:3},{value:"<code>pre > code > element</code>",id:"pre--code--element",level:3},{value:"<code>code</code>",id:"code",level:2},{value:"<code>code > string</code>",id:"code--string",level:3},{value:"<code>code > string[]</code>",id:"code--string-1",level:3},{value:"<code>code > element</code>",id:"code--element",level:3},{value:"<code>code > element[]</code>",id:"code--element-1",level:3},{value:"<code>CodeBlock</code>",id:"codeblock",level:2},{value:"<code>CodeBlock > string</code>",id:"codeblock--string",level:3},{value:"<code>CodeBlock > string[]</code>",id:"codeblock--string-1",level:3},{value:"<code>CodeBlock > element</code>",id:"codeblock--element",level:3},{value:"<code>CodeBlock > element[]</code>",id:"codeblock--element-1",level:3},{value:"Code blocks with line numbering tests",id:"code-blocks-with-line-numbering-tests",level:2},{value:"Code block wrapping tests",id:"code-block-wrapping-tests",level:2},{value:"Magic comments tests",id:"magic-comments-tests",level:2},{value:"HTML - script + style highlighting",id:"html---script--style-highlighting",level:2},{value:"Empty code blocks edge cases",id:"empty-code-blocks-edge-cases",level:2}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h1,{id:"code-block-tests",children:"Code block tests"}),"\n",(0,r.jsx)(t.admonition,{title:"legacy test page - MDX v1",type:"danger",children:(0,r.jsx)(t.p,{children:"This test page is quite outdated: MDX v2 lowercase tags are not substituted anymore in the same way as they were in v1."})}),"\n",(0,r.jsx)(t.hr,{}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-java",children:'class HelloWorld {\n public static void main(String args[]) {\n System.out.println("Hello, World");\n }\n}\n'})}),"\n",(0,r.jsx)(t.p,{children:"See:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/1584",children:"https://github.com/facebook/docusaurus/pull/1584"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/3749",children:"https://github.com/facebook/docusaurus/pull/3749"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/6177",children:"https://github.com/facebook/docusaurus/pull/6177"})}),"\n"]}),"\n",(0,r.jsx)(t.h2,{id:"code-block-prism-language-tests",children:"Code block prism language tests"}),"\n",(0,r.jsxs)(t.p,{children:["Code block with/without the good prism language case(lower or upper) in ",(0,r.jsx)(t.code,{children:"additionalLanguages[]"})]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-php",metastring:'title="php"',children:'<?php\n$x=15;\n$y=30;\n$z=$x+$y;\necho "Sum: ",$z;\n?>\n'})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-PHP",metastring:'title="PHP"',children:'<?php\n$x=15;\n$y=30;\n$z=$x+$y;\necho "Sum: ",$z;\n?>\n'})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-pHp",metastring:'title="pHp"',children:'<?php\n$x=15;\n$y=30;\n$z=$x+$y;\necho "Sum: ",$z;\n?>\n'})}),"\n",(0,r.jsx)(t.p,{children:"See:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9183",children:"https://github.com/facebook/docusaurus/pull/9183"})}),"\n"]}),"\n",(0,r.jsx)(t.h2,{id:"pre",children:(0,r.jsx)(t.code,{children:"pre"})}),"\n",(0,r.jsx)(t.h3,{id:"pre--string",children:(0,r.jsx)(t.code,{children:"pre > string"})}),"\n",(0,r.jsxs)(t.p,{children:["Multi-line text inside ",(0,r.jsx)(t.code,{children:"pre"})," will turn into one-liner, but it's okay (",(0,r.jsx)(t.a,{href:"https://github.com/mdx-js/mdx/issues/1095",children:"https://github.com/mdx-js/mdx/issues/1095"}),")"]}),"\n",(0,r.jsx)("pre",{children:"1 2 3"}),"\n","\n",(0,r.jsx)("pre",{children:(0,r.jsx)(t.p,{children:"1\n2\n3"})}),"\n",(0,r.jsx)(t.h3,{id:"pre--string-1",children:(0,r.jsx)(t.code,{children:"pre > string[]"})}),"\n",(0,r.jsx)("pre",{children:(0,r.jsxs)(t.p,{children:["1","\n","2","\n","3","\n"]})}),"\n",(0,r.jsx)(t.h3,{id:"pre--element",children:(0,r.jsx)(t.code,{children:"pre > element"})}),"\n",(0,r.jsx)("pre",{children:(0,r.jsx)(c.Z,{children:"Lol bro"})}),"\n",(0,r.jsx)(t.h3,{id:"pre--element-1",children:(0,r.jsx)(t.code,{children:"pre > element[]"})}),"\n",(0,r.jsxs)("pre",{children:[(0,r.jsx)("a",{href:"/",children:"Front page"}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)("strong",{children:"Input: "}),'a = "abcd", b = "cdabcdab"',"\n","\n",(0,r.jsx)("strong",{children:"Output: "}),"3","\n","\n",(0,r.jsx)("strong",{children:"Explanation: "}),'a after three repetitions become "ab\n',(0,r.jsx)("strong",{children:"cdabcdab"}),'cd", at which time b is a substring.',"\n"]})]}),"\n",(0,r.jsx)(t.h3,{id:"pre--code--element",children:(0,r.jsx)(t.code,{children:"pre > code > element"})}),"\n",(0,r.jsx)("pre",{children:(0,r.jsx)("code",{children:(0,r.jsx)("b",{children:"Hey bro"})})}),"\n",(0,r.jsx)(t.h2,{id:"code",children:(0,r.jsx)(t.code,{children:"code"})}),"\n",(0,r.jsx)(t.h3,{id:"code--string",children:(0,r.jsx)(t.code,{children:"code > string"})}),"\n",(0,r.jsx)("code",{children:"1 2 3"}),"\n",(0,r.jsx)("code",{children:"link:\n title: front page\n path: /docs/"}),"\n",(0,r.jsx)(t.h3,{id:"code--string-1",children:(0,r.jsx)(t.code,{children:"code > string[]"})}),"\n",(0,r.jsx)("code",{children:(0,r.jsxs)(t.p,{children:["link:"," \n","\n"," ","title: front page","\n","\n"," ","path: /docs/","\n"]})}),"\n",(0,r.jsx)(t.h3,{id:"code--element",children:(0,r.jsx)(t.code,{children:"code > element"})}),"\n",(0,r.jsx)("code",{children:(0,r.jsx)(c.Z,{children:"Lol bro"})}),"\n",(0,r.jsx)(t.h3,{id:"code--element-1",children:(0,r.jsx)(t.code,{children:"code > element[]"})}),"\n",(0,r.jsxs)("code",{children:[(0,r.jsx)("a",{href:"/",children:"Front page"}),(0,r.jsx)("br",{}),(0,r.jsxs)(t.p,{children:[(0,r.jsx)("strong",{children:"Input: "}),'a = "abcd", b = "cdabcdab"']}),(0,r.jsx)("br",{}),(0,r.jsxs)(t.p,{children:[(0,r.jsx)("strong",{children:"Output: "}),"3",(0,r.jsx)("br",{}),"\n",(0,r.jsx)("strong",{children:"Explanation: "}),'a after three repetitions become "ab',(0,r.jsx)("strong",{children:"\ncdabcdab\n"}),'cd", at which time b is a substring.']}),(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(t.h2,{id:"codeblock",children:(0,r.jsx)(t.code,{children:"CodeBlock"})}),"\n",(0,r.jsx)(t.h3,{id:"codeblock--string",children:(0,r.jsx)(t.code,{children:"CodeBlock > string"})}),"\n",(0,r.jsx)(s.Z,{children:"1 2 3"}),"\n",(0,r.jsx)(s.Z,{className:"language-yaml",title:"test",children:"link:\n title: front page\n path: /docs/"}),"\n",(0,r.jsx)(t.h3,{id:"codeblock--string-1",children:(0,r.jsx)(t.code,{children:"CodeBlock > string[]"})}),"\n",(0,r.jsx)(s.Z,{className:"language-yaml",title:"test",children:(0,r.jsxs)(t.p,{children:["link:","\n","\n"," ","title: front page","\n","\n"," ","path: /docs/","\n"]})}),"\n",(0,r.jsx)(t.h3,{id:"codeblock--element",children:(0,r.jsx)(t.code,{children:"CodeBlock > element"})}),"\n",(0,r.jsx)(s.Z,{className:"language-yaml",title:"test",children:(0,r.jsx)(c.Z,{children:"Lol bro"})}),"\n",(0,r.jsx)(t.h3,{id:"codeblock--element-1",children:(0,r.jsx)(t.code,{children:"CodeBlock > element[]"})}),"\n",(0,r.jsxs)(s.Z,{className:"language-yaml",title:"test",children:[(0,r.jsx)("a",{href:"/",children:"Front page"}),(0,r.jsx)("br",{}),(0,r.jsxs)(t.p,{children:[(0,r.jsx)("strong",{children:"Input: "}),'a = "abcd", b = "cdabcdab"']}),(0,r.jsx)("br",{}),(0,r.jsxs)(t.p,{children:[(0,r.jsx)("strong",{children:"Output: "}),"3",(0,r.jsx)("br",{}),"\n",(0,r.jsx)("strong",{children:"Explanation: "}),'a after three repetitions become "ab',(0,r.jsx)("strong",{children:"\ncdabcdab\n"}),'cd", at which time b is a substring.']}),(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(t.h2,{id:"code-blocks-with-line-numbering-tests",children:"Code blocks with line numbering tests"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-jsx",children:'function PageLayout(props) {\n // highlight-next-line\n return <Layout title="Awesome Docusaurus page" description="Test Test Test Test Test Test Test Test Test Test Test Test Test Test ">;\n}\n'})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-jsx",metastring:"showLineNumbers",children:'function PageLayout(props) {\n // highlight-next-line\n return <Layout title="Awesome Docusaurus page" description="Test Test Test Test Test Test Test Test Test Test Test Test Test Test ">;\n}\n'})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-jsx",metastring:"{1,3,6} showLineNumbers",children:"function PageLayout(props) {\n console.log(\n 'Test Test Test Test Test Test Test Test Test Test Test Test Test Test ',\n );\n console.log(\n 'Test Test Test Test Test Test Test Test Test Test Test Test Test Test ',\n );\n console.log(\n 'Test Test Test Test Test Test Test Test Test Test Test Test Test Test ',\n );\n console.log(\n 'Test Test Test Test Test Test Test Test Test Test Test Test Test Test ',\n );\n console.log(\n 'Test Test Test Test Test Test Test Test Test Test Test Test Test Test ',\n );\n console.log(\n 'Test Test Test Test Test Test Test Test Test Test Test Test Test Test ',\n );\n console.log(\n 'Test Test Test Test Test Test Test Test Test Test Test Test Test Test ',\n );\n console.log(\n 'Test Test Test Test Test Test Test Test Test Test Test Test Test Test ',\n );\n console.log(\n 'Test Test Test Test Test Test Test Test Test Test Test Test Test Test ',\n );\n}\n"})}),"\n",(0,r.jsx)(t.h2,{id:"code-block-wrapping-tests",children:"Code block wrapping tests"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:'mkdir this_is_a_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_string_to_test_code_block_wrapping\necho "this is a long string made up of many separate words that should be broken between words when possible"\ncurl https://docusaurus.io/tests/pages/code-block-tests\n'})}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(i.Z,{value:"short-tab-1",label:"Short tab",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:'echo "hi"\n'})})}),(0,r.jsx)(i.Z,{value:"long-tab",label:"Long tab",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"echo this will test whether a long string that is initially hidden will have the option to wrap when made visible\n"})})}),(0,r.jsx)(i.Z,{value:"short-tab-2",label:"Short tab",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"rm short_initially_hidden_string\n"})})})]}),"\n",(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(i.Z,{value:"long-tab",label:"Long tab",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"echo medium_length_string_will_have_the_option_to_wrap_after_window_resized_while_it_is_hidden\n"})})}),(0,r.jsx)(i.Z,{value:"short-tab",label:"Short tab",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:'echo "short_initially_hidden_string"\n'})})})]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-jsx",metastring:"showLineNumbers",children:"import React from 'react';\nimport Layout from '@theme/Layout';\n\nexport default function MyReactPage() {\n return (\n <Layout>\n <h1>My React page</h1>\n <p>\n This is a React page. Let's make this sentence bit long. Some more words\n to make sure... Some more words to make sure... Some more words to make\n sure...\n </p>\n </Layout>\n );\n}\n"})}),"\n",(0,r.jsx)(t.h2,{id:"magic-comments-tests",children:"Magic comments tests"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-lua",metastring:'title="lua_sum.lua"',children:"function sum(n)\n -- highlight-next-line\n local result = 0\n for i = 1, n do\n -- highlight-start\n result = result + i\n end\n -- highlight-end\n print(result)\nend\n"})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-haskell",metastring:'title="haskell.hs"',children:"stringLength :: String -> Int\n-- highlight-next-line\nstringLength [] = 0\nstringLength (x:xs) = 1 + stringLength xs\n"})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-wasm",metastring:'title="sum_webAssembly.wasm"',children:'(module\n ;; highlight-next-line\n (func $add (param $a i32) (param $b i32) (result i32)\n local.get $a\n ;; highlight-start\n local.get $b\n i32.add)\n ;; highlight-end\n (export "add" (func $add)))\n'})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-sql",metastring:'title="sql_query.sql"',children:"-- highlight-start\nSELECT *\nFROM orders\n-- highlight-end\nWHERE customer_id IN (\n SELECT customer_id\n -- highlight-next-line\n FROM customers\n WHERE country = 'USA'\n)\n"})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-matlab",metastring:'title="matlab.m"',children:"% highlight-start\nfunction result = times2(n)\n result = n * 2;\nend\n% highlight-end\n\nx = 10;\n% highlight-next-line\ny = times2(x);\n"})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-latex",metastring:'title="latex.tex"',children:"\\begin{document}\n\t\\section{Triangles}\n\t% highlight-next-line\n\t\\subsection{Pythagoras' Theorem}\n\tPythagoras's theorem is:\n\t% highlight-start\n\t\\begin{equation}\n\t\tc^2 = a^2 + b^2\n\t\\end{equation}\n\t% highlight-end\n\\end{document}\n"})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-vba",metastring:'title="vba.vb"',children:"Function Factorial(ByVal n As Long) As Long\n If n < 0 Then\n Err.Raise 5 ' Invalid argument\n End If\n 'highlight-next-line\n Factorial = 1 ' return value\n Dim i As Long\n ' highlight-start\n For i = 2 To n\n Factorial = Factorial * i\n Next\n ' highlight-end\nEnd Function\n"})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-vbnet",metastring:'title="vbnet.vb"',children:'\' highlight-next-line\nDim languages As New HashSet(Of String) From {\n "C#",\n "Visual Basic",\n _ \' highlight-start\n "F#",\n "PowerShell",\n "TypeScript"\n _\' highlight-end\n}\n'})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-batch",metastring:'title="cmd.bat"',children:"rem highlight-start\n@echo off\nsetlocal\nRem highlight-end\nipconfig\nREM highlight-next-line\necho Docusaurus is awesome\nnetstat\n"})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-fortran",metastring:'title="fortran.f90"',children:'! highlight-start\nprogram hello\n! highlight-end\n implicit none\n ! highlight-next-line\n print *, "Hello, World!"\nend program hello\n'})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-cobol",metastring:'title="cobol.cob"',children:'*> highlight-start\nIDENTIFICATION DIVISION.\nPROGRAM-ID. HELLO.\n*> highlight-end\nPROCEDURE DIVISION.\n *> highlight-next-line\n DISPLAY "Hello, World!".\nEND PROGRAM HELLO.\n'})}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-fsharp",metastring:'title="fsharp.fsx"',children:'(* highlight-start *)\n[<EntryPoint>]\n(* highlight-end *)\nlet main _ =\n // highlight-next-line\n printfn "Hello, World!"\n 0\n'})}),"\n",(0,r.jsx)(t.h2,{id:"html---script--style-highlighting",children:"HTML - script + style highlighting"}),"\n",(0,r.jsxs)(t.p,{children:["See ",(0,r.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/issues/9517",children:"https://github.com/facebook/docusaurus/issues/9517"})]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-html",children:"<html lang=\"en\">\n <head>\n <script>\n const name = 'Formidable';\n console.log(name);\n <\/script>\n <style>\n .some-class {\n border: solid red thick;\n }\n </style>\n </head>\n</html>\n"})}),"\n",(0,r.jsx)(t.h2,{id:"empty-code-blocks-edge-cases",children:"Empty code blocks edge cases"}),"\n",(0,r.jsx)(t.p,{children:"Empty inline code block: ``"}),"\n",(0,r.jsxs)(t.p,{children:["Single space inline code block: ",(0,r.jsx)(t.code,{children:" "})]}),"\n",(0,r.jsx)(t.p,{children:"Empty code block"}),"\n","\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{})}),"\n",(0,r.jsx)(t.p,{children:"Empty 1 line code block"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{})}),"\n",(0,r.jsx)(t.p,{children:"Empty 2 line code block"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{})}),"\n",(0,r.jsx)(t.p,{children:"Empty live code block"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-js",metastring:"live",live:!0})})]})}function g(e={}){const{wrapper:t}={...(0,o.a)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}}}]); |