Closed ptgott closed 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 |
Converting to draft while I work out some issues:
malformed Var element within a code snippet
errors in this build.
Update: It turns out this error happens when processing a VarList
.
Fixes #186
Syntax highlighting in the docs engine works by using
rehype-highlight
, which is a wrapper forhighlight.js
.highlight.js
applies syntax highlighting by replacing the contents of a<pre><code></code></pre>
with<span>
elements that includehljs-*
class names.The way
highlight.js
works poses difficulties for addingVar
components to syntax-highlighted code snippets, since any content within a code snippet becomes subject to rewrites byhighlight.js
.Without access to the
highlight.js
internals, we need to:Var
experience inside and outside code snippetsVar
s from being overwrittenThis change presents a solution that:
Var
components with UUIDs: This minimizes the chance that aVar
component will be highlighted, since characters in[a-z0-9]
are usually permissible within strings or identifiers. This also removes hyphens and begins the placeholder with a letter to help ensure the highlighter parses it as an identifier.