Skip to content

Automatically wrap the definition component on relevant terms #1323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 47 commits into
base: main
Choose a base branch
from

Conversation

S3Prototype
Copy link
Collaborator

@S3Prototype S3Prototype commented May 2, 2025

This PR adds a custom rehype plugin that wraps the first instance of certain technical terms in a <Definition> component automatically. Here's how it looks:

example.mp4

Preview here

Because this plugin adds the component automatically, we get this functionality for free everywhere in the docs. This opens up a lot of possibilities:

  1. We can add as many technical terms as we think users may be confused by, and since the component is a popover they can learn the meanings without leaving the page.
  2. We could potentially add our own product terminology to the list of terms. For example, if we add "Traffic Policy" and link to that docs page, then the first instance of Traffic Policy on every page of the docs will automatically be linked. The same goes for our other terms
  3. We can define proprietary terms like "ngrok's cloud service" without having a full dedicated docs page

How to test

Mostly, click around the site and see if the terms listed are highlighted on the pages they appear on.

Terms include:

  • IP CIDR
  • CEL
  • Gateway API CDR
  • CDR
  • SCIM
  • JIT Provisioning
  • K8s
  • Ingress
  • TCP Keepalive
  • v3
  • v2
  • OWASP
  • Helm
  • TLS Termination
  • ALPN
  • SNI

Considerations

  • I've noticed no apparent slowdown in page loads either in localhost or in the preview deployment as a result of this plugin
  • Vercel build times appear to be slower by 1 minute due to this plugin (from 7.5 minutes to 8.5 minutes). Local build times appear to be slower by about 1 minute as well.
    • For localhost, this is only relevant to the initial build of the site when running pnpm run dev. HMR is not slower.

Copy link

vercel bot commented May 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
ngrok-docs ✅ Ready (Inspect) Visit Preview Jun 23, 2025 4:31pm

@S3Prototype S3Prototype force-pushed the shaquil/doc-267-automatically-wrap-the-definition-component-on-relevant branch from bf5c415 to 0df0fc1 Compare May 7, 2025 20:44
@S3Prototype S3Prototype force-pushed the shaquil/doc-267-automatically-wrap-the-definition-component-on-relevant branch from 393748c to 7ec8d39 Compare May 7, 2025 20:49
@S3Prototype S3Prototype marked this pull request as ready for review May 8, 2025 17:13
…nent-on-relevant' of https://github.com/ngrok/ngrok-docs into shaquil/doc-267-automatically-wrap-the-definition-component-on-relevant
@S3Prototype S3Prototype force-pushed the shaquil/doc-267-automatically-wrap-the-definition-component-on-relevant branch from 3a08f8f to 1f0a112 Compare June 23, 2025 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs/infra Changes to the infrastructure of the docs site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants