From ed6608ba3f81e087d6d62026f8461ff9e181bd31 Mon Sep 17 00:00:00 2001 From: rakesh Date: Thu, 29 Jan 2026 12:09:53 +0530 Subject: [PATCH 1/2] Fix broken p5.* reference links in reference pages --- src/layouts/ReferenceItemLayout.astro | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/layouts/ReferenceItemLayout.astro b/src/layouts/ReferenceItemLayout.astro index fc07d820be..fcec122ff6 100644 --- a/src/layouts/ReferenceItemLayout.astro +++ b/src/layouts/ReferenceItemLayout.astro @@ -90,7 +90,15 @@ const descriptionParts = description.split( /(
[\s\S]+?<\/code><\/pre>)/gm
 );
 
----
+// Normalizes malformed p5.* reference anchors (e.g. "#/p5.Element")
+// to proper reference routes ("/reference/p5/p5.Element/")
+function normalizeP5ReferenceLinks(html) {
+  if (!html) return html;
+  return html.replace(
+    /href="#\/(p5\.[^"]+)"/g,
+    'href="/reference/p5/$1/"'
+  );
+}
 
 
 
@@ -208,7 +216,7 @@ const descriptionParts = description.split(
                           class="col-span-5 [&_p]:m-0 [&_p]:inline [&_a]:underline"
                     >
                       {param.type && {param.type}: }
-                      
+                      
                     
                   
                 ))}
@@ -226,7 +234,7 @@ const descriptionParts = description.split(
                           class="col-span-5 [&_p]:m-0 [&_p]:inline [&_a]:underline"
                         >
                           {param.type && {param.type}: }
-                          
+                          
                         
                       
                     )
@@ -246,7 +254,7 @@ const descriptionParts = description.split(
                       class="col-span-5 [&_p]:m-0 [&_p]:inline [&_a]:underline"
                 >
                   {entry.data.return.type && {entry.data.return.type}: }
-                  
+                  
                 
               
             

From 0b7101faa416df4a531ee360fbea3c84536ab29f Mon Sep 17 00:00:00 2001
From: rakesh 
Date: Thu, 29 Jan 2026 12:57:58 +0530
Subject: [PATCH 2/2] Add types for normalizeP5ReferenceLinks helper

---
 src/layouts/ReferenceItemLayout.astro | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/layouts/ReferenceItemLayout.astro b/src/layouts/ReferenceItemLayout.astro
index fcec122ff6..f523b1a7ae 100644
--- a/src/layouts/ReferenceItemLayout.astro
+++ b/src/layouts/ReferenceItemLayout.astro
@@ -92,13 +92,14 @@ const descriptionParts = description.split(
 
 // Normalizes malformed p5.* reference anchors (e.g. "#/p5.Element")
 // to proper reference routes ("/reference/p5/p5.Element/")
-function normalizeP5ReferenceLinks(html) {
+function normalizeP5ReferenceLinks(html: string | undefined): string | undefined {
   if (!html) return html;
   return html.replace(
     /href="#\/(p5\.[^"]+)"/g,
     'href="/reference/p5/$1/"'
   );
 }
+---