Skip to content

Conversation

alexisintech
Copy link
Member

@alexisintech alexisintech commented Oct 14, 2025

Description

The @paramExtensions tag was relying on a "## Returns" section to inject the paramExtensions content before that "## Returns" section. But sometimes, a page will not have a "## Returns" section, and therefore, the logic wasn't injecting the paramExtensions content anywhere.

This PR updates the logic to look for any heading following "## Parameters" and inject the paramExtensions content before it. If it can't find one, it injects the content at the bottom of the page (so at the very least, the content is at least on the page).

FIXES DOCS-11069

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Documentation
    • Improved placement of additional parameter details in generated API docs: extra content is now inserted after the “Parameters” section and before the next heading (or at the end if no subsequent heading exists). Insertion is skipped when no “Parameters” section is present.
  • Chores
    • Added a changeset entry to record this documentation update; no functional impact.

@changeset-bot
Copy link

changeset-bot bot commented Oct 14, 2025

🦋 Changeset detected

Latest commit: bdc2522

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Oct 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Oct 15, 2025 10:23pm

@alexisintech alexisintech requested a review from NWylynko October 14, 2025 19:28
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

Updates the Typedoc custom theme to change where paramExtension is inserted: it now anchors at the "## Parameters" heading, finds the next heading, and inserts before that (or appends if none). Also adds a new changeset file that contains only YAML front-matter delimiters.

Changes

Cohort / File(s) Summary of Changes
Docs build theme logic
.typedoc/custom-theme.mjs
Replaces previous insertion-before-"## Returns" behavior with: locate the "## Parameters" heading, find the immediate next heading (lines starting with "##"), compute insertion index (before that heading or at end), and insert paramExtension only when "## Parameters" exists. Adds index calculations and a guard.
Repo metadata
.changeset/five-schools-repair.md
New file added containing only YAML front-matter delimiters (---); no executable code or configuration changes.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Dev as Dev
    participant TD as TypeDoc
    participant Theme as custom-theme.mjs
    participant Page as Markdown

    Dev->>TD: Run docs build
    TD->>Theme: Provide rendered page items
    Theme->>Page: Search for "## Parameters"
    alt "## Parameters" found
        Theme->>Page: Scan forward for next "##" heading
        alt Next heading exists
            Theme->>Page: Insert paramExtension before next heading
        else No subsequent heading
            Theme->>Page: Append paramExtension at end
        end
    else "## Parameters" not found
        Theme->>Page: Do not insert paramExtension
    end
    Page-->>TD: Emit updated markdown
    TD-->>Dev: Generated docs
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I hop through docs with nimble feet,
Find "Parameters" where the headings meet.
If another title stands ahead,
I tuck my lines just before its bed.
If none remain, I burrow to the end. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "chore(repo): Fix typedoc paramextension tag" is concise, specific, and directly related to the main change in the changeset. The raw summary confirms that the primary modification is to .typedoc/custom-theme.mjs, which updates the paramExtension insertion logic to fix a bug where content was not being injected when a "## Returns" heading was absent. The title accurately captures this core fix without unnecessary verbosity or vague terminology.
Linked Issues Check ✅ Passed The PR directly addresses DOCS-11069 by fixing the paramExtension insertion logic in .typedoc/custom-theme.mjs. The linked issue reports missing documentation for the verify-token page, specifically the verify-token-options section, which was likely not appearing due to the insertion logic failing to find a "## Returns" heading. The code change updates the logic to locate the heading after "## Parameters" and injects content before it, or at the page bottom if no further heading exists, ensuring paramExtension content now appears regardless of the presence of a "## Returns" section.
Out of Scope Changes Check ✅ Passed All changes in this PR are directly scoped to the linked issue. The primary functional change in .typedoc/custom-theme.mjs explicitly fixes the paramExtension insertion bug that was causing missing documentation. The .changeset/five-schools-repair.md file is a standard changelog entry that documents this fix and is a typical part of the development workflow in versioned monorepos. No unrelated modifications or scope creep are present in the changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch aa/fix-param-extension-tag

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6dd02ca and bdc2522.

📒 Files selected for processing (1)
  • .typedoc/custom-theme.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
.typedoc/custom-theme.mjs (1)

82-98: LGTM! The paramExtension injection logic correctly addresses the issue.

The new approach properly handles cases where the "## Returns" heading is missing by:

  1. Locating the "## Parameters" section as the anchor point
  2. Finding the next heading after it (any level, with or without leading newline)
  3. Inserting content before that heading, or appending at the end if none exists

The guard on line 85 correctly prevents insertion when no Parameters section exists. The heading detection on line 91 appropriately handles both direct headings (##) and those with a leading newline (\n##), which can occur depending on how the content is split by the delimiter.

Note: The past review suggestion to use findIndex() has been implemented.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.typedoc/custom-theme.mjs (2)

79-79: Remove the empty comment.

This empty comment serves no purpose and should be removed to keep the code clean.

Apply this diff:

-          //
           if (paramExtensionTag) {

83-84: Consider more precise heading matching.

The current includes('## Parameters') check could theoretically match false positives like "## Parameters and More". While unlikely in typical TypeDoc output, a more precise check would improve robustness.

Apply this diff:

             // Find the index of the item that contains '## Parameters'
-            const parametersIndex = splitOutput.findIndex(item => item.includes('## Parameters'));
+            const parametersIndex = splitOutput.findIndex(item => item.trim().startsWith('## Parameters'));
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 070c25b and c80466d.

📒 Files selected for processing (2)
  • .changeset/five-schools-repair.md (1 hunks)
  • .typedoc/custom-theme.mjs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/five-schools-repair.md
🪛 LanguageTool
.changeset/five-schools-repair.md

[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: --- ---

(QB_NEW_DE)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
.typedoc/custom-theme.mjs (2)

86-98: LGTM! The next-heading search logic is correct.

The implementation properly:

  • Guards against invalid parametersIndex
  • Searches forward from the Parameters section
  • Uses appropriate regex to match markdown headings
  • Handles the case where no subsequent heading exists

100-103: LGTM! Insertion logic correctly fixes the reported issue.

The implementation now properly injects paramExtension content:

  • Before the next heading (if one exists after Parameters)
  • At the end of the page (if no subsequent heading exists)

This addresses the issue reported in DOCS-11069 where content was not appearing when the "## Returns" heading was missing.

Comment on lines +1 to +2
---
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Complete the changeset file for automated releases.

This changeset file is incomplete. According to the project's coding guidelines, automated releases require proper Changesets format. A valid changeset should include:

  1. Package names and version bump types between the YAML delimiters:
---
"@clerk/backend": patch
---
  1. A description of the changes below the front matter:
---
"@clerk/backend": patch
---

Fix typedoc paramExtension tag injection to work without "## Returns" heading
🧰 Tools
🪛 LanguageTool

[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: --- ---

(QB_NEW_DE)

🤖 Prompt for AI Agents
In .changeset/five-schools-repair.md around lines 1 to 2, the changeset is
empty; add a proper Changesets front matter containing the package name(s) and
the version bump type (patch/minor/major) between the YAML delimiters and then
add a short description of the change below the front matter so automated
releases can parse it (e.g., include "@clerk/backend": patch in the YAML and a
one-line description of the fix beneath).

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 14, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6990

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6990

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6990

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6990

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6990

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6990

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6990

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6990

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6990

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6990

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6990

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6990

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6990

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6990

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6990

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6990

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6990

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6990

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6990

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6990

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6990

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6990

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6990

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6990

commit: bdc2522

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.typedoc/custom-theme.mjs (1)

82-103: LGTM! Logic correctly addresses the injection issue.

The new implementation properly handles cases where the "## Returns" heading is absent by scanning for any heading after "## Parameters" and inserting content before it (or at the end if no heading exists). The bounds checking and index calculations are correct.

Minor: Consider renaming stuff for clarity.

The variable name stuff (line 80) could be more descriptive:

-            const stuff = this.helpers.getCommentParts(paramExtensionTag.content);
+            const paramExtensionContent = this.helpers.getCommentParts(paramExtensionTag.content);

             // Find the index of the item that contains '## Parameters'
             const parametersIndex = splitOutput.findIndex(item => item.includes('## Parameters'));
@@ ... @@
               // (or at the end of the entire page if no heading found)
               const insertIndex = nextHeadingIndex !== -1 ? nextHeadingIndex : splitOutput.length;
-              splitOutput.splice(insertIndex, 0, stuff);
+              splitOutput.splice(insertIndex, 0, paramExtensionContent);
             }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c80466d and 6dd02ca.

📒 Files selected for processing (1)
  • .typedoc/custom-theme.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan

Comment on lines 87 to 97
let nextHeadingIndex = -1;
for (let i = parametersIndex + 1; i < splitOutput.length; i++) {
const item = splitOutput[i].trim();

// The next header has to, at a minimum, start with ##
// because it comes after '## Parameters'
if (item.match(/^##/)) {
nextHeadingIndex = i;
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let nextHeadingIndex = -1;
for (let i = parametersIndex + 1; i < splitOutput.length; i++) {
const item = splitOutput[i].trim();
// The next header has to, at a minimum, start with ##
// because it comes after '## Parameters'
if (item.match(/^##/)) {
nextHeadingIndex = i;
break;
}
}
const nextHeadingIndex = splitOutput.findIndex((item, index) => {
// skip the items before the parameters
if (index <= parametersIndex) return false;
// find the next heading
return item.startsWith('##') || item.startsWith('\n##')
})

Can we just use another findIndex()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeth .-.
bdc2522

@alexisintech alexisintech merged commit 25f54f6 into main Oct 22, 2025
41 checks passed
@alexisintech alexisintech deleted the aa/fix-param-extension-tag branch October 22, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants