{"sha":"30e7d6bb0071061868c2eb01f74be74fe4b3697d","node_id":"C_kwDORD3Y59oAKDMwZTdkNmJiMDA3MTA2MTg2OGMyZWIwMWY3NGJlNzRmZTRiMzY5N2Q","commit":{"author":{"name":"gizzy","email":"me@gizzy.pro","date":"2026-02-02T19:22:36Z"},"committer":{"name":"gizzy","email":"me@gizzy.pro","date":"2026-02-02T19:22:36Z"},"message":"feat: improved detection of language by parsing child, fix for copy button coping the copy button too not just the code","tree":{"sha":"b9c2c441a705dcf0ca686efabaf6d154ddd135b9","url":"https://api.github.com/repos/GizzyUwU/govgiz/git/trees/b9c2c441a705dcf0ca686efabaf6d154ddd135b9"},"url":"https://api.github.com/repos/GizzyUwU/govgiz/git/commits/30e7d6bb0071061868c2eb01f74be74fe4b3697d","comment_count":0,"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null,"verified_at":null}},"url":"https://api.github.com/repos/GizzyUwU/govgiz/commits/30e7d6bb0071061868c2eb01f74be74fe4b3697d","html_url":"https://github.com/GizzyUwU/govgiz/commit/30e7d6bb0071061868c2eb01f74be74fe4b3697d","comments_url":"https://api.github.com/repos/GizzyUwU/govgiz/commits/30e7d6bb0071061868c2eb01f74be74fe4b3697d/comments","author":{"login":"GizzyUwU","id":61115942,"node_id":"MDQ6VXNlcjYxMTE1OTQy","avatar_url":"https://avatars.githubusercontent.com/u/61115942?v=4","gravatar_id":"","url":"https://api.github.com/users/GizzyUwU","html_url":"https://github.com/GizzyUwU","followers_url":"https://api.github.com/users/GizzyUwU/followers","following_url":"https://api.github.com/users/GizzyUwU/following{/other_user}","gists_url":"https://api.github.com/users/GizzyUwU/gists{/gist_id}","starred_url":"https://api.github.com/users/GizzyUwU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GizzyUwU/subscriptions","organizations_url":"https://api.github.com/users/GizzyUwU/orgs","repos_url":"https://api.github.com/users/GizzyUwU/repos","events_url":"https://api.github.com/users/GizzyUwU/events{/privacy}","received_events_url":"https://api.github.com/users/GizzyUwU/received_events","type":"User","user_view_type":"public","site_admin":false},"committer":{"login":"GizzyUwU","id":61115942,"node_id":"MDQ6VXNlcjYxMTE1OTQy","avatar_url":"https://avatars.githubusercontent.com/u/61115942?v=4","gravatar_id":"","url":"https://api.github.com/users/GizzyUwU","html_url":"https://github.com/GizzyUwU","followers_url":"https://api.github.com/users/GizzyUwU/followers","following_url":"https://api.github.com/users/GizzyUwU/following{/other_user}","gists_url":"https://api.github.com/users/GizzyUwU/gists{/gist_id}","starred_url":"https://api.github.com/users/GizzyUwU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GizzyUwU/subscriptions","organizations_url":"https://api.github.com/users/GizzyUwU/orgs","repos_url":"https://api.github.com/users/GizzyUwU/repos","events_url":"https://api.github.com/users/GizzyUwU/events{/privacy}","received_events_url":"https://api.github.com/users/GizzyUwU/received_events","type":"User","user_view_type":"public","site_admin":false},"parents":[{"sha":"acf0304757e1e5c7969d7b2221a0db2447cd3e6e","url":"https://api.github.com/repos/GizzyUwU/govgiz/commits/acf0304757e1e5c7969d7b2221a0db2447cd3e6e","html_url":"https://github.com/GizzyUwU/govgiz/commit/acf0304757e1e5c7969d7b2221a0db2447cd3e6e"}],"stats":{"total":77,"additions":43,"deletions":34},"files":[{"sha":"2b268a378052f1a2e1c29bb454a33fa663aaca40","filename":"plugins/mdxPrism.ts","status":"modified","additions":37,"deletions":26,"changes":63,"blob_url":"https://github.com/GizzyUwU/govgiz/blob/30e7d6bb0071061868c2eb01f74be74fe4b3697d/plugins%2FmdxPrism.ts","raw_url":"https://github.com/GizzyUwU/govgiz/raw/30e7d6bb0071061868c2eb01f74be74fe4b3697d/plugins%2FmdxPrism.ts","contents_url":"https://api.github.com/repos/GizzyUwU/govgiz/contents/plugins%2FmdxPrism.ts?ref=30e7d6bb0071061868c2eb01f74be74fe4b3697d","patch":"@@ -6,33 +6,44 @@ import tsx from \"refractor/tsx\";\n refractor.register(tsx);\n \n export default function mdxPrism() {\n-\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n-\treturn (tree: any) => {\n-\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n-\t\tvisit(tree, \"element\" as any, visitor);\n-\t};\n+  // biome-ignore lint/suspicious/noExplicitAny: <explanation>\n+  return (tree: any) => {\n+    visit(tree, \"element\", (node, _i, parent) => {\n+      if (node.tagName === \"code\" && parent?.tagName === \"pre\") {\n+        const className = node.properties?.className;\n+        if (!Array.isArray(className)) return;\n+        const langClass = className.find((c: string) =>\n+          c.startsWith(\"language-\"),\n+        );\n+        if (!langClass) return;\n+        const lang = langClass.replace(\"language-\", \"\");\n+        parent.properties = { ...(parent.properties || {}), lang };\n+      }\n+\t  visitor(node, _i, parent)\n+    });\n+  };\n+  \n+  // biome-ignore lint/suspicious/noExplicitAny: <explanation>\n+  function visitor(node: any, index: number | undefined, parent: any) {\n+    if (parent.type !== \"mdxJsxFlowElement\") {\n+      return;\n+    }\n \n-\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n-\tfunction visitor(node: any, index: number | undefined, parent: any) {\n-\t\tif (parent.type !== \"mdxJsxFlowElement\") {\n-\t\t\treturn;\n-\t\t}\n+    // biome-ignore lint/suspicious/noExplicitAny: <explanation>\n+    const attrs = parent.attributes.reduce((a: any, c: any) => {\n+      if (c.type === \"mdxJsxAttribute\") {\n+        a[c.name] = c.value;\n+      }\n+      return a;\n+    }, {});\n \n-\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n-\t\tconst attrs = parent.attributes.reduce((a: any, c: any) => {\n-\t\t\tif (c.type === \"mdxJsxAttribute\") {\n-\t\t\t\ta[c.name] = c.value;\n-\t\t\t}\n-\t\t\treturn a;\n-\t\t}, {});\n+    const lang = attrs.lang;\n+    if (!lang) {\n+      return;\n+    }\n \n-\t\tconst lang = attrs.lang;\n-\t\tif (!lang) {\n-\t\t\treturn;\n-\t\t}\n+    const result = refractor.highlight(nodeToString(node), lang);\n \n-\t\tconst result = refractor.highlight(nodeToString(node), lang);\n-\n-\t\tnode.children = result.children;\n-\t}\n-};\n\\ No newline at end of file\n+    node.children = result.children;\n+  }\n+}"},{"sha":"b802eb3dd395f264d92edfba47fa69c87861652f","filename":"src/components/Markdown.tsx","status":"modified","additions":6,"deletions":8,"changes":14,"blob_url":"https://github.com/GizzyUwU/govgiz/blob/30e7d6bb0071061868c2eb01f74be74fe4b3697d/src%2Fcomponents%2FMarkdown.tsx","raw_url":"https://github.com/GizzyUwU/govgiz/raw/30e7d6bb0071061868c2eb01f74be74fe4b3697d/src%2Fcomponents%2FMarkdown.tsx","contents_url":"https://api.github.com/repos/GizzyUwU/govgiz/contents/src%2Fcomponents%2FMarkdown.tsx?ref=30e7d6bb0071061868c2eb01f74be74fe4b3697d","patch":"@@ -19,9 +19,7 @@ const Ul: ParentComponent = (props) => (\n   <ul class=\"govuk-list govuk-list--bullet\">{props.children}</ul>\n );\n \n-const Li: ParentComponent = (props) => (\n-  <li>{props.children}</li>\n-);\n+const Li: ParentComponent = (props) => <li>{props.children}</li>;\n \n export const Blockquote: ParentComponent = (props) => {\n   let ref!: HTMLDivElement;\n@@ -46,10 +44,10 @@ const Pre: ParentComponent<{\n   file?: string;\n   children: JSXElement;\n }> = (props) => {\n+  console.log(\"uhh\", props.lang);\n   const [copied, setCopied] = createSignal(false);\n   const [open, setOpen] = createSignal<boolean>(false);\n-  let ref!: HTMLPreElement;\n-  let divRef!: HTMLDivElement;\n+  let ref!: HTMLDivElement;\n \n   const onCopy = () => {\n     setCopied(true);\n@@ -87,17 +85,15 @@ const Pre: ParentComponent<{\n             href=\"#\"\n             onClick={toggle}\n           >\n-            {props.displayLang}\n+            {props.displayLang || props.lang || \"Unknown\"}\n           </a>\n         </li>\n       </ul>\n       <div\n         class=\"govuk-tabs__panel \"\n-        ref={divRef}\n         style={{ display: open() ? \"block\" : \"none\" }}\n       >\n         <pre\n-          ref={ref}\n           class={`language-${props.lang}`}\n           data-line={props.lines}\n           style={{\n@@ -121,7 +117,9 @@ const Pre: ParentComponent<{\n           >\n             {copied() ? \"Copied!\" : \"Copy code\"}\n           </button>\n+          <div           ref={ref}>\n           {props.children}\n+          </div>\n         </pre>\n       </div>\n     </div>"}]}