gravitational / docs

Source code backing goteleport.com/docs
https://goteleport.com/docs
Apache License 2.0
11 stars 13 forks source link

Support `Var`s in syntax-highlighted snippets #366

Closed ptgott closed 1 year ago

ptgott commented 1 year ago

Fixes #186

Syntax highlighting in the docs engine works by using rehype-highlight, which is a wrapper for highlight.js. highlight.js applies syntax highlighting by replacing the contents of a <pre><code></code></pre> with <span> elements that include hljs-* class names.

The way highlight.js works poses difficulties for adding Var components to syntax-highlighted code snippets, since any content within a code snippet becomes subject to rewrites by highlight.js.

Without access to the highlight.js internals, we need to:

This change presents a solution that:

vercel[bot] commented 1 year ago

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

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 9, 2023 6:39pm
ptgott commented 1 year ago

Converting to draft while I work out some issues: