Skip to content

fix(api-docs): strip empty HTML comments from markdown exports#17992

Open
cvxluo wants to merge 1 commit into
masterfrom
cvxluo/strip-empty-html-comments-from-markdown-exports
Open

fix(api-docs): strip empty HTML comments from markdown exports#17992
cvxluo wants to merge 1 commit into
masterfrom
cvxluo/strip-empty-html-comments-from-markdown-exports

Conversation

@cvxluo
Copy link
Copy Markdown
Contributor

@cvxluo cvxluo commented Jun 2, 2026

Remove extra artifacts in the markdown version of the API docs. We were inserting extra comment markers (<!-- -->) and spaces (&#x20) within the API docs.

Before:

* `status`*&#x20;<!-- -->(<!-- -->string<!-- -->)*

After:

* `status` *(string)*

DESCRIBE YOUR PR

Tell us what you're changing and why. If your PR resolves an issue, please link it so it closes automatically.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

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

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment Jun 2, 2026 6:30pm
sentry-docs Ready Ready Preview, Comment Jun 2, 2026 6:30pm

Request Review

Two sources of noise leaked into the API .md exports, e.g.
`*&#x20;<!-- -->(<!-- -->string<!-- -->)*`:

- React inserts empty `<!-- -->` separator comments between adjacent text
  nodes in server-rendered output (common on component-rendered pages like
  the API docs). Drop comment nodes in the HTML->markdown pipeline; comments
  dispatch by node type, so this lives in nodeHandlers, not handlers.
- The parameter type was wrapped in an <em> with a leading space inside it,
  which remark encoded as `&#x20;`. Move the space outside the <em> so it
  serializes as a normal space.

Also bump CACHE_VERSION, since cached entries are keyed on input HTML (not on
this script) and would otherwise serve stale output after the logic change.

Co-Authored-By: Claude <noreply@anthropic.com>
<dt>
<div>
<code data-index>{param.name}</code>
<code data-index>{param.name}</code>{' '}
Copy link
Copy Markdown
Contributor Author

@cvxluo cvxluo Jun 2, 2026

Choose a reason for hiding this comment

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

seems like this extra space in the <em> was getting rendered as &#x20, so moving this lets us go from:
* status*&#x20;<!-- -->(<!-- -->string<!-- -->)*
to

  • status (string)

@cvxluo cvxluo changed the title fix(md-exports): strip empty HTML comments from markdown exports fix(api-docs): strip empty HTML comments from markdown exports Jun 2, 2026
@cvxluo cvxluo marked this pull request as ready for review June 2, 2026 18:31
@cvxluo cvxluo requested review from a team June 2, 2026 18:31
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9d48e59. Configure here.

<code data-index>{param.name}</code>{' '}
{!!param.schema?.type && (
<em>
{' '}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unconditional trailing space when schema type is missing

Low Severity

The {' '} space after <code> is now rendered unconditionally, but it only makes sense as a separator when the <em> type annotation follows. Previously the space lived inside the conditional <em> block and was only emitted when param.schema?.type was truthy. If a parameter ever lacks a schema type at runtime (which the defensive optional chaining ?. suggests is possible), there will be a stray trailing space after the parameter name.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9d48e59. Configure here.

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.

1 participant