nucleus-quark-highlighter
Quark sheets and Nucleus-style HTML, highlighted and formatted in VS Code / Cursor — the same grammar that colors every code block on this site.
The Nucleus & Quark Syntax Highlighter extension adds a Quark language for .quark files, highlights Quark inside <quark-sheet> in HTML, and gives custom elements and dashed attributes their own color so Adapters and their state stand apart from native markup. Tags, custom tags, attributes and custom attributes share one palette in both grammars, so a sheet and the markup it orchestrates read the same way.
<section>
<provider-fetch api-url="/api/todos">
<ul><template><li></li></template></ul>
</provider-fetch>
<quark-sheet>
provider-fetch[is-success] {
$todos: prop("provision").body;
ul { content: iterate($todos); }
li { content: item.title; }
}
</quark-sheet>
</section><section>
<provider-fetch api-url="/api/todos">
<ul><template><li></li></template></ul>
</provider-fetch>
<quark-sheet>
provider-fetch[is-success] {
$todos: prop("provision").body;
ul { content: iterate($todos); }
li { content: item.title; }
}
</quark-sheet>
</section>Features
- Quark language
.quarkfiles with CSS-familiar highlighting, folding, bracket matching and/* */comments; Quark's at-rules —@use,@scope,@onwith its event list,@dispatch/@command,@view-transition,@delay,@warn/@debug/@error— color their names, options groups, durations, messages and blocks - Quark's language, nothing else An at-rule Quark does not have, such as
@mediaor@keyframes, is colored as an error, because Quark's parser rejects it - Inline sheets Quark inside
<quark-sheet>in HTML is highlighted as Quark - Custom elements stand out Dashed tags / dashed attributes get their own color in HTML and in Quark selectors; a dashed tag keeps that color wherever it appears in a selector — attribute-qualified, inside
:is()/:not()/:has(), or before a pseudo-class or pseudo-element - Format Document
.quarkfiles format with@excom/quark-formatter(Shift+Alt+F) - Format inline sheets
Quark: Format <quark-sheet> blocksformats every sheet in the open HTML file - File icon
.quarkfiles carry the Quark icon in the explorer and tabs - Shiki grammar
@excom/nucleus-quark-highlighter/shikihighlights Quark / Nucleus HTML in docs and static sites
Installation
Install Nucleus & Quark Syntax Highlighter from the editor's Extensions view, or from the registries directly:
- VS Code — Visual Studio Marketplace, or
ext install excom.nucleus-quark-highlighterin Quick Open - Cursor / VSCodium / Windsurf — these editors do not read the Marketplace; install the
.vsixby hand (below)
To install a build by hand, download nucleus-quark-highlighter-<version>.vsix from the GitHub releases and run code --install-extension <file> (cursor --install-extension in Cursor).
For docs sites and build tooling the grammar is also on npm:
npm install @excom/nucleus-quark-highlighternpm install @excom/nucleus-quark-highlighterUsage
Open a .quark file and the language mode is Quark. Open any HTML file and <quark-sheet> bodies, custom elements and dashed attributes are colored without further setup.
Formatting
.quarkfiles — Format Document (Shift+Alt+F, or format-on-save) reformats the whole file- Inline sheets in HTML — run Quark: Format
<quark-sheet>blocks from the Command Palette; every sheet body in the active file is formatted and re-indented one level past its tag
Inline sheets need the command because VS Code's HTML formatter only formats the <style> / <script> bodies it knows about and offers no hook for custom tags. A sheet that does not parse is left untouched and the reason appears in the status bar.
Shortcuts
Cmd+/ (Ctrl+/) and Shift+Alt+A both toggle /* */ comments. Quark's comments are CSS's own, so there are no // line comments.
Highlighting with Shiki
The extension's TextMate grammars are exported for Shiki:
import { createHighlighter } from "shiki";
import { shikiLangs } from "@excom/nucleus-quark-highlighter/shiki";
const highlighter = await createHighlighter({
themes: ["github-light", "github-dark"],
langs: ["html", "css", ...shikiLangs],
});
highlighter.codeToHtml(source, { lang: "quark", theme: "github-dark" });import { createHighlighter } from "shiki";
import { shikiLangs } from "@excom/nucleus-quark-highlighter/shiki";
const highlighter = await createHighlighter({
themes: ["github-light", "github-dark"],
langs: ["html", "css", ...shikiLangs],
});
highlighter.codeToHtml(source, { lang: "quark", theme: "github-dark" });quark highlights standalone sheets. html-custom-elements is an injection: once registered, every html block gets custom-element / dashed-attribute coloring and Quark highlighting inside <quark-sheet>. Load css alongside them; the Quark grammar embeds it.
Attributes
Role —option is configurable, state
is managed by the element (read-only), or hybrid which is both.
Provision
Thisprovision property lives on the DOM node.
Read / watch it with Quark’s prop("provision"), or listen
for the neutron-provision event from app JS.
Events
Type
command event (HTML Command API): from a
<button command commandfor>, an <event-handler
command-name>, or a CommandEvent.
Recognized Elements
Child or descendant elements are recognized by and relevant to its functionality.Styles
@custom-selector synonyms so custom elements can share
semantic styles. Element aliases match the host tag / .tag-* class; state
aliases match attributes (nested under the element alias).
Release notes (2)
0.1.5
- Fix highlighting after a bare word directly before a closing bracket, as in
if($a: 1; else: preserve): the rest of the sheet was coloured as one value. Remove the///documentation comment rule: Quark has only/* … */comments, so a///line is no longer coloured as one in the editor
0.1.1
- Ship only dist (and declared extras) in the npm tarball; drop build logs, tests and sources
- Fix vsix packaging (the npm files allowlist replaces .vscodeignore), ship the MIT license text, and publish the extension to the Visual Studio Marketplace and Open VSX from CI with the vsix attached to a GitHub release
Release notes
e.preventDefault() is not
synchronously called on the event.
all: revert-layer.
Valence.css ships this as .unstyled and .unstyled-all for the entire tree.