PageSourceSearch

https://designcode.io/assets/MarkdownRenderer-D8kmHhDa.js

js designcode.io collected 2026-10-02 02:45:51 UTC 4,045 bytes, 3 lines download raw bytes

1import{j as a,r as l}from"./index-BuFAflkI.js";import{I as C}from"./FooterEngravedTerrain-fWsG7KkU.js";import{H as d,f as A,y as S,x as k,t as b,s as T,a as M,p as H,b as E,m as G,j as I,c as _,d as $,e as v}from"./index-eO92F6Ri.js";import{M as R,r as U}from"./index-B0oGP_YH.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./App-DhdNK-t0.js";const j={bash:v,css:$,javascript:_,json:I,markdown:G,plaintext:E,python:H,sql:M,swift:T,typescript:b,xml:k,yaml:S},P={bash:["sh","shell"],javascript:["js","jsx"],markdown:["md"],plaintext:["text","txt"],python:["py"],typescript:["ts","tsx"],xml:["html"],yaml:["yml"]},J={bash:"Bash",css:"CSS",html:"HTML",javascript:"JavaScript",js:"JavaScript",json:"JSON",jsx:"JSX",markdown:"Markdown",md:"Markdown",plaintext:"Plain Text",python:"Python",py:"Python",sh:"Shell",shell:"Shell",text:"Plain Text",ts:"TypeScript",tsx:"TSX",typescript:"TypeScript",xml:"XML",yaml:"YAML",yml:"YAML"};Object.entries(j).forEach(([e,s])=>{d.registerLanguage(e,s)});const g=A(j);g.registerAlias(P);const q=e=>{const s=Array.isArray(e?.properties?.className)?e.properties.className:[];for(const r of s){if(r==="no-highlight"||r==="nohighlight")return!1;const c=/^lang(?:uage)?-(.+)$/i.exec(String(r));if(c)return c[1].toLowerCase()}},N=e=>e?e.type==="text"?String(e.value||""):e.type==="element"&&e.tagName==="br"?`
2`:Array.isArray(e.children)?e.children.map(N).join(""):"":"",B=()=>e=>{const s=(r,c=null)=>{if(r?.type==="element"&&r.tagName==="code"&&c?.tagName==="pre"){const t=q(r);if(t&&g.registered(t)){const o=g.highlight(t,N(r)),n=Array.isArray(r.properties.className)?r.properties.className:[];n.includes("hljs")||n.unshift("hljs"),r.properties.className=n,o.children.length&&(r.children=o.children)}}Array.isArray(r?.children)&&r.children.forEach(t=>s(t,r))};s(e)},y=e=>typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(y).join(""):e?.props?.children?y(e.props.children):"",O=(e="")=>{const s=/language-([\w-]+)/i.exec(String(e));return s?s[1].toLowerCase():null},x=(e="")=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),X=(e,s)=>{const r=e||" ";if(!s||!d.getLanguage(s))return x(e||" ");try{return d.highlight(r,{language:s,ignoreIllegals:!0}).value}catch{return x(e||" ")}},Y=({children:e,...s})=>{const[r,c]=l.useState(!1),t=l.useRef(0),o=l.Children.toArray(e).find(i=>i&&typeof i=="object"&&i.type==="code"),n=o?.props?.className||"",p=O(n),f=p?J[p]||p.replace(/-/g," ").toUpperCase():"Code",m=y(o?.props?.children),u=l.useMemo(()=>{const i=m.replace(/\n$/,"");return i.length?i.split(`
3`):[""]},[m]),L=l.useMemo(()=>u.map(i=>X(i,p)),[u,p]);l.useEffect(()=>()=>{t.current&&window.clearTimeout(t.current)},[]);const w=async()=>{if(m)try{await navigator.clipboard.writeText(m),c(!0),t.current&&window.clearTimeout(t.current),t.current=window.setTimeout(()=>{c(!1),t.current=0},1800)}catch{c(!1)}};return a.jsxs("div",{className:"curriculum-code-block",children:[a.jsxs("div",{className:"curriculum-code-block-header",children:[a.jsx("span",{className:"curriculum-code-block-lang",children:f}),a.jsxs("button",{type:"button",className:`curriculum-code-block-copy${r?" is-copied":""}`,onClick:w,"aria-label":r?"Copied code":`Copy ${f} code`,children:[a.jsx(C,{icon:r?"solar:check-circle-linear":"solar:copy-linear","aria-hidden":"true"}),a.jsx("span",{children:r?"Copied":"Copy"})]})]}),a.jsx("pre",{...s,className:`curriculum-code-block-pre${s.className?` ${s.className}`:""}`,children:a.jsx("code",{className:n||"hljs",children:u.map((i,h)=>a.jsxs("span",{className:"curriculum-code-line",children:[a.jsx("span",{className:"curriculum-code-line-number","aria-hidden":"true",children:h+1}),a.jsx("span",{className:"curriculum-code-line-content",dangerouslySetInnerHTML:{__html:L[h]}})]},`${h}-${i}`))})})]})};function W({children:e,components:s={},rehypePlugins:r=[],remarkPlugins:c=[],...t}){return a.jsx(R,{...t,components:{pre:Y,...s},remarkPlugins:[U,...c],rehypePlugins:[B,...r],children:e})}export{W as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.