diff --git a/src/layouts/ReferenceItemLayout.astro b/src/layouts/ReferenceItemLayout.astro index fc07d820be..f523b1a7ae 100644 --- a/src/layouts/ReferenceItemLayout.astro +++ b/src/layouts/ReferenceItemLayout.astro @@ -90,6 +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: string | undefined): string | undefined {
+ if (!html) return html;
+ return html.replace(
+ /href="#\/(p5\.[^"]+)"/g,
+ 'href="/reference/p5/$1/"'
+ );
+}
---
@@ -208,7 +217,7 @@ const descriptionParts = description.split(
class="col-span-5 [&_p]:m-0 [&_p]:inline [&_a]:underline"
>
{param.type && {param.type}: }
-
+
))}
@@ -226,7 +235,7 @@ const descriptionParts = description.split(
class="col-span-5 [&_p]:m-0 [&_p]:inline [&_a]:underline"
>
{param.type && {param.type}: }
-
+
)
@@ -246,7 +255,7 @@ const descriptionParts = description.split(
class="col-span-5 [&_p]:m-0 [&_p]:inline [&_a]:underline"
>
{entry.data.return.type && {entry.data.return.type}: }
-
+