From 74064e91f8fc8d219b7d7f839aa980d802b5de66 Mon Sep 17 00:00:00 2001
From: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
Date: Wed, 13 May 2026 10:59:49 -0400
Subject: [PATCH] fix(api): prefix the property and method headings to avoid
duplicates
---
.../index.js | 36 +++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/plugins/docusaurus-plugin-ionic-component-api/index.js b/plugins/docusaurus-plugin-ionic-component-api/index.js
index 3a020ff7f8..0eedab7833 100644
--- a/plugins/docusaurus-plugin-ionic-component-api/index.js
+++ b/plugins/docusaurus-plugin-ionic-component-api/index.js
@@ -132,6 +132,38 @@ function formatMultiline(str) {
return str.split('\n\n').join('
').split('\n').join(' ');
}
+/**
+ * Kebab-case slug for API identifiers (camelCase props, method names).
+ */
+function apiIdentifierSlug(name) {
+ return name
+ .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
+ .replace(/_/g, '-')
+ .toLowerCase();
+}
+
+/**
+ * Heading id for Properties subheadings.
+ * Prefixes IDs with `prop-` so they never collide with narrative sections on the same
+ * doc page that use headings like "Shape", "Fill", or "Size".
+ *
+ * Anchors become `#prop-${slug}` rather than `#${slug}`.
+ */
+function propertyHeadingId(propName) {
+ return `prop-${apiIdentifierSlug(propName)}`;
+}
+
+/**
+ * Heading id for Methods subheadings.
+ * Prefixes IDs with `method-` so they never collide with narrative sections on the same
+ * doc page that use headings like "Dismiss", "Present", or "Close".
+ *
+ * Anchors become `#method-${slug}` rather than `#${slug}`.
+ */
+function methodHeadingId(methodName) {
+ return `method-${apiIdentifierSlug(methodName)}`;
+}
+
function formatType(attr, type) {
if (attr === 'color') {
/**
@@ -181,7 +213,7 @@ ${properties
}
return `
-### ${prop.name} ${isDeprecated ? '(deprecated)' : ''}
+### ${prop.name} ${isDeprecated ? '(deprecated)' : ''} {#${propertyHeadingId(prop.name)}}
| | |
| --- | --- |
@@ -243,7 +275,7 @@ function renderMethods({ methods }) {
${methods
.map(
(method) => `
-### ${method.name}
+### ${method.name} {#${methodHeadingId(method.name)}}
| | |
| --- | --- |