pre
",id:"pre",level:2},{value:"pre > string
",id:"pre--string",level:3},{value:"pre > string[]
",id:"pre--string-1",level:3},{value:"pre > element
",id:"pre--element",level:3},{value:"pre > element[]
",id:"pre--element-1",level:3},{value:"pre > code > element
",id:"pre--code--element",level:3},{value:"code
",id:"code",level:2},{value:"code > string
",id:"code--string",level:3},{value:"code > string[]
",id:"code--string-1",level:3},{value:"code > element
",id:"code--element",level:3},{value:"code > element[]
",id:"code--element-1",level:3},{value:"CodeBlock
",id:"codeblock",level:2},{value:"CodeBlock > string
",id:"codeblock--string",level:3},{value:"CodeBlock > string[]
",id:"codeblock--string-1",level:3},{value:"CodeBlock > element
",id:"codeblock--element",level:3},{value:"CodeBlock > element[]
",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 m(e){let t={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",hr:"hr",li:"li",p:"p",pre:"pre",ul:"ul",...(0,r.a)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(t.header,{children:(0,l.jsx)(t.h1,{id:"code-block-tests",children:"Code block tests"})}),"\n",(0,l.jsx)(t.admonition,{title:"legacy test page - MDX v1",type:"danger",children:(0,l.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,l.jsx)(t.hr,{}),"\n",(0,l.jsx)(t.pre,{children:(0,l.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,l.jsx)(t.p,{children:"See:"}),"\n",(0,l.jsxs)(t.ul,{children:["\n",(0,l.jsx)(t.li,{children:(0,l.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/1584",children:"https://github.com/facebook/docusaurus/pull/1584"})}),"\n",(0,l.jsx)(t.li,{children:(0,l.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/3749",children:"https://github.com/facebook/docusaurus/pull/3749"})}),"\n",(0,l.jsx)(t.li,{children:(0,l.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/6177",children:"https://github.com/facebook/docusaurus/pull/6177"})}),"\n"]}),"\n",(0,l.jsx)(t.h2,{id:"code-block-prism-language-tests",children:"Code block prism language tests"}),"\n",(0,l.jsxs)(t.p,{children:["Code block with/without the good prism language case(lower or upper) in ",(0,l.jsx)(t.code,{children:"additionalLanguages[]"})]}),"\n",(0,l.jsx)(t.pre,{children:(0,l.jsx)(t.code,{className:"language-php",metastring:'title="php"',children:'\n'})}),"\n",(0,l.jsx)(t.pre,{children:(0,l.jsx)(t.code,{className:"language-PHP",metastring:'title="PHP"',children:'\n'})}),"\n",(0,l.jsx)(t.pre,{children:(0,l.jsx)(t.code,{className:"language-pHp",metastring:'title="pHp"',children:'\n'})}),"\n",(0,l.jsx)(t.p,{children:"See:"}),"\n",(0,l.jsxs)(t.ul,{children:["\n",(0,l.jsx)(t.li,{children:(0,l.jsx)(t.a,{href:"https://github.com/facebook/docusaurus/pull/9183",children:"https://github.com/facebook/docusaurus/pull/9183"})}),"\n"]}),"\n",(0,l.jsx)(t.h2,{id:"pre",children:(0,l.jsx)(t.code,{children:"pre"})}),"\n",(0,l.jsx)(t.h3,{id:"pre--string",children:(0,l.jsx)(t.code,{children:"pre > string"})}),"\n",(0,l.jsxs)(t.p,{children:["Multi-line text inside ",(0,l.jsx)(t.code,{children:"pre"})," will turn into one-liner, but it's okay (",(0,l.jsx)(t.a,{href:"https://github.com/mdx-js/mdx/issues/1095",children:"https://github.com/mdx-js/mdx/issues/1095"}),")"]}),"\n",(0,l.jsx)("pre",{children:"1 2 3"}),"\n","\n",(0,l.jsx)("pre",{children:(0,l.jsx)(t.p,{children:"1\n2\n3"})}),"\n",(0,l.jsx)(t.h3,{id:"pre--string-1",children:(0,l.jsx)(t.code,{children:"pre > string[]"})}),"\n",(0,l.jsx)("pre",{children:(0,l.jsxs)(t.p,{children:["1","\n","2","\n","3","\n"]})}),"\n",(0,l.jsx)(t.h3,{id:"pre--element",children:(0,l.jsx)(t.code,{children:"pre > element"})}),"\n",(0,l.jsx)("pre",{children:(0,l.jsx)(i.Z,{children:"Lol bro"})}),"\n",(0,l.jsx)(t.h3,{id:"pre--element-1",children:(0,l.jsx)(t.code,{children:"pre > element[]"})}),"\n",(0,l.jsxs)("pre",{children:[(0,l.jsx)("a",{href:"/",children:"Front page"}),"\n",(0,l.jsxs)(t.p,{children:[(0,l.jsx)("strong",{children:"Input: "}),'a = "abcd", b = "cdabcdab"',"\n","\n",(0,l.jsx)("strong",{children:"Output: "}),"3","\n","\n",(0,l.jsx)("strong",{children:"Explanation: "}),'a after three repetitions become "ab\n',(0,l.jsx)("strong",{children:"cdabcdab"}),'cd", at which time b is a substring.',"\n"]})]}),"\n",(0,l.jsx)(t.h3,{id:"pre--code--element",children:(0,l.jsx)(t.code,{children:"pre > code > element"})}),"\n",(0,l.jsx)("pre",{children:(0,l.jsx)("code",{children:(0,l.jsx)("b",{children:"Hey bro"})})}),"\n",(0,l.jsx)(t.h2,{id:"code",children:(0,l.jsx)(t.code,{children:"code"})}),"\n",(0,l.jsx)(t.h3,{id:"code--string",children:(0,l.jsx)(t.code,{children:"code > string"})}),"\n",(0,l.jsx)("code",{children:"1 2 3"}),"\n",(0,l.jsx)("code",{children:`link:
title: front page
path: /docs/`}),"\n",(0,l.jsx)(t.h3,{id:"code--string-1",children:(0,l.jsx)(t.code,{children:"code > string[]"})}),"\n",(0,l.jsx)("code",{children:(0,l.jsxs)(t.p,{children:["link:"," \n","\n"," ","title: front page","\n","\n"," ","path: /docs/","\n"]})}),"\n",(0,l.jsx)(t.h3,{id:"code--element",children:(0,l.jsx)(t.code,{children:"code > element"})}),"\n",(0,l.jsx)("code",{children:(0,l.jsx)(i.Z,{children:"Lol bro"})}),"\n",(0,l.jsx)(t.h3,{id:"code--element-1",children:(0,l.jsx)(t.code,{children:"code > element[]"})}),"\n",(0,l.jsxs)("code",{children:[(0,l.jsx)("a",{href:"/",children:"Front page"}),(0,l.jsx)("br",{}),(0,l.jsxs)(t.p,{children:[(0,l.jsx)("strong",{children:"Input: "}),'a = "abcd", b = "cdabcdab"']}),(0,l.jsx)("br",{}),(0,l.jsxs)(t.p,{children:[(0,l.jsx)("strong",{children:"Output: "}),"3",(0,l.jsx)("br",{}),"\n",(0,l.jsx)("strong",{children:"Explanation: "}),'a after three repetitions become "ab',(0,l.jsx)("strong",{children:"\ncdabcdab\n"}),'cd", at which time b is a substring.']}),(0,l.jsx)("br",{})]}),"\n",(0,l.jsx)(t.h2,{id:"codeblock",children:(0,l.jsx)(t.code,{children:"CodeBlock"})}),"\n",(0,l.jsx)(t.h3,{id:"codeblock--string",children:(0,l.jsx)(t.code,{children:"CodeBlock > string"})}),"\n",(0,l.jsx)(o.Z,{children:"1 2 3"}),"\n",(0,l.jsx)(o.Z,{className:"language-yaml",title:"test",children:`link:
title: front page
path: /docs/`}),"\n",(0,l.jsx)(t.h3,{id:"codeblock--string-1",children:(0,l.jsx)(t.code,{children:"CodeBlock > string[]"})}),"\n",(0,l.jsx)(o.Z,{className:"language-yaml",title:"test",children:(0,l.jsxs)(t.p,{children:["link:","\n","\n"," ","title: front page","\n","\n"," ","path: /docs/","\n"]})}),"\n",(0,l.jsx)(t.h3,{id:"codeblock--element",children:(0,l.jsx)(t.code,{children:"CodeBlock > element"})}),"\n",(0,l.jsx)(o.Z,{className:"language-yaml",title:"test",children:(0,l.jsx)(i.Z,{children:"Lol bro"})}),"\n",(0,l.jsx)(t.h3,{id:"codeblock--element-1",children:(0,l.jsx)(t.code,{children:"CodeBlock > element[]"})}),"\n",(0,l.jsxs)(o.Z,{className:"language-yaml",title:"test",children:[(0,l.jsx)("a",{href:"/",children:"Front page"}),(0,l.jsx)("br",{}),(0,l.jsxs)(t.p,{children:[(0,l.jsx)("strong",{children:"Input: "}),'a = "abcd", b = "cdabcdab"']}),(0,l.jsx)("br",{}),(0,l.jsxs)(t.p,{children:[(0,l.jsx)("strong",{children:"Output: "}),"3",(0,l.jsx)("br",{}),"\n",(0,l.jsx)("strong",{children:"Explanation: "}),'a after three repetitions become "ab',(0,l.jsx)("strong",{children:"\ncdabcdab\n"}),'cd", at which time b is a substring.']}),(0,l.jsx)("br",{})]}),"\n",(0,l.jsx)(t.h2,{id:"code-blocks-with-line-numbering-tests",children:"Code blocks with line numbering tests"}),"\n",(0,l.jsx)(t.pre,{children:(0,l.jsx)(t.code,{className:"language-jsx",children:'function PageLayout(props) {\n // highlight-next-line\n return \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
\n