CodeBlock
Overview
The CodeBlock component renders a block of code with a header that labels its language and copies it, and lines a highlighter can color.
Reach for it for install commands, file excerpts, diffs, and the code in a chat reply as it
streams in. It renders its code through Pre, so while a line runs past the
edge the code is a tab stop the keyboard can scroll, named by the title or the language. Its copy
button is a CopyButton and its wrap toggle a
ToggleButton.
Highlighting is a highlighter you pass, per block or app-wide on
ConfigProvider, that splits the code into lines
of typed tokens. CodeBlock renders those tokens as text in its own classes, colored from Bulma's
*-on-scheme colors, and never as HTML. bestax ships no highlighter: this page builds one on
Prism and one on Shiki, and the live examples use a
tokenizer small enough to write inline.
Bulma has <pre> and no code block, so CodeBlock brings its own styles, in bestax.css and its
variants, or in extras.css next to your own Bulma.
Import
import { CodeBlock } from '@allxsmith/bestax-bulma';
Usage
Basic Usage
Pass the code as a string, and its language for the label. The copy button copies the code
itself, without one line break at its very end, so a pasted command doesn't run as it lands.
<CodeBlock code="npm install @allxsmith/bestax-bulma" language="bash" />
A Title and Line Numbers
title is a caption at the start of the header, such as a file name, and it names the code for a
screen reader. showLineNumbers numbers each line, and startLine sets the first number, for an
excerpt from partway through a file. The numbers are drawn by CSS, so they're never copied or read
out.
<CodeBlock title="Counter.tsx" language="tsx" showLineNumbers startLine={12} code={`export function Counter() { const [count, setCount] = useState(0); return ( <Button onClick={() => setCount(count + 1)}> Clicked {count} times </Button> ); }`} />
Highlighted Lines
highlightLines picks lines out, counting the code's own lines from 1 whatever startLine is.
Each is a <mark>, with a bar at its start.
<CodeBlock language="ts" showLineNumbers highlightLines={[2, 3]} code={`const config = { retries: 3, timeout: 5000, cache: true, };`} />
Diff Lines
addedLines and removedLines mark the lines of a diff. Each is an <ins> or a <del>, with a
+ or a - beside it, so the color isn't the only sign. The markers stay out of a copy, which
copies the code as you passed it.
<CodeBlock language="js" showLineNumbers removedLines={[2]} addedLines={[3]} code={`function greet(name) { return 'Hello ' + name; return \`Hello \${name}\`; }`} />
Wrapping Long Lines
A long line scrolls sideways. showWrapToggle adds a toggle that wraps it instead, and a wrapped
line lines up under its own text, past the line numbers. defaultWrap starts it wrapped, and
wrap with onWrapChange holds the state yourself, such as to remember the reader's choice.
<CodeBlock language="bash" showWrapToggle code={`curl -X POST https://api.example.com/v1/projects/42/deployments --header "Authorization: Bearer $TOKEN" --data '{"branch": "main"}'`} />
A Maximum Height
maxHeight lets the code grow to a height, then scroll, with the header staying above it. A number
is pixels, and a string is any CSS length.
<CodeBlock title="build.log" maxHeight="12rem" code={Array.from( { length: 40 }, (_, i) => `[${String(i + 1).padStart(2, '0')}] compiled module ${i + 1}` ).join('\n')} />
Sizes
size sizes the code, the header and its buttons together.
<> <CodeBlock size="small" language="bash" code="pnpm test" /> <CodeBlock language="bash" code="pnpm test" /> <CodeBlock size="medium" language="bash" code="pnpm test" /> <CodeBlock size="large" language="bash" code="pnpm test" /> </>
Your Own Buttons
actions puts buttons of your own in the header, before the wrap toggle and the copy button.
showCopyButton={false} takes the copy button away, and showLanguage={false} the label.
<CodeBlock language="bash" code="pnpm dev" actions={ <Button size="small" color="link" isLight> Run </Button> } />
Your Own Words
labels names the buttons and words the copy's announcements, for another language.
<CodeBlock language="bash" code="npm install" showWrapToggle labels={{ copy: 'Copier le code', copiedStatus: 'Code copié', failedStatus: 'Impossible de copier le code', wrap: 'Retour à la ligne', }} />
Highlighting
A highlighter's tokenize(code, language, state) returns the code's lines, each an array of
{ content, type } tokens, or null for a language it doesn't know, which renders plain with the
label still showing. The types are keyword, string, number, comment, function, type,
property, tag, attribute, operator, punctuation and variable, and a token without one
renders in the code's own color. CodeBlock calls it only when the block has a language, and code
with a line over 5,000 characters, such as minified code, renders plain without calling it.
Pass the function as highlighter, or an object with it as tokenize and an optional load. Pass
one that stays the same from render to render, defined at module scope or in a useMemo: CodeBlock
remembers the lines it tokenized, and the languages it loaded, only while it's the same
highlighter, so a tokenize written inline tokenizes the whole code, and tries load again, every
render. A plain object is the same while its tokenize is, so an object written inline around a
tokenize defined once is fine, and a class instance is its own: another instance of the class
starts over. In a live example, holding the tokenizer in state keeps it the same.
import type { CodeBlockTokenize } from '@allxsmith/bestax-bulma'; function example() { // Held in state, so it's the same function on every render. Each line is // tokenized on its own, so it hands back a state (`null`), and a stream // tokenizes only its new lines. const [tokenize] = useState(() => { const tokenizeLines: CodeBlockTokenize = code => ({ state: null, lines: code.split('\n').map(line => line .split( /(\/\/.*|'[^']*'|\b(?:const|return|import|from|export)\b|\b\d+\b)/ ) .filter(Boolean) .map(content => ({ content, type: content.startsWith('//') ? 'comment' : content.startsWith("'") ? 'string' : /^\d+$/.test(content) ? 'number' : /^(const|return|import|from|export)$/.test(content) ? 'keyword' : undefined, })) ), }); return tokenizeLines; }); return ( <CodeBlock title="retry.ts" language="ts" highlighter={tokenize} showLineNumbers code={`import { wait } from './wait'; // Tries again up to 3 times export const retries = 3; export const delay = 250;`} /> ); }
One Highlighter for the App
codeHighlighter on ConfigProvider is the highlighter every CodeBlock inside uses unless it's
given its own, the way iconLibrary sets the icon library. A block's highlighter={null} renders
it plain.
import { CodeBlock, ConfigProvider } from '@allxsmith/bestax-bulma';
import { prismHighlighter } from './prismHighlighter';
export function App() {
return (
<ConfigProvider codeHighlighter={prismHighlighter}>
<CodeBlock code="const answer = 42;" language="ts" />
<CodeBlock code="plain text" language="txt" highlighter={null} />
</ConfigProvider>
);
}
A Prism Highlighter
Prism tokenizes a whole string into a tree of named tokens, synchronously.
This adapter maps its token names to CodeBlock's types and splits the tree into lines. Prism keeps
no state between calls, so it returns none, and a block streaming in is tokenized whole each time
it grows. Import the languages you need from prismjs/components/.
import Prism from 'prismjs';
import 'prismjs/components/prism-typescript';
import 'prismjs/components/prism-jsx';
import 'prismjs/components/prism-tsx';
import type {
CodeBlockHighlighter,
CodeBlockToken,
CodeBlockTokenType,
} from '@allxsmith/bestax-bulma';
/** Prism's token names, and the type each is in CodeBlock. */
const TYPES: Record<string, CodeBlockTokenType> = {
keyword: 'keyword',
boolean: 'keyword',
string: 'string',
'template-string': 'string',
char: 'string',
regex: 'string',
number: 'number',
comment: 'comment',
function: 'function',
'class-name': 'type',
builtin: 'type',
property: 'property',
tag: 'tag',
'attr-name': 'attribute',
operator: 'operator',
punctuation: 'punctuation',
variable: 'variable',
};
/** Walks Prism's token tree, starting a new line at each newline. */
function toLines(
stream: Prism.TokenStream,
type: CodeBlockTokenType | undefined,
lines: CodeBlockToken[][]
) {
if (typeof stream === 'string') {
stream.split('\n').forEach((text, i) => {
if (i > 0) lines.push([]);
if (text) lines[lines.length - 1].push({ content: text, type });
});
} else if (Array.isArray(stream)) {
for (const part of stream) toLines(part, type, lines);
} else {
toLines(stream.content, TYPES[stream.type] ?? type, lines);
}
return lines;
}
export const prismHighlighter: CodeBlockHighlighter = {
tokenize(code, language) {
const grammar = Prism.languages[language];
if (!grammar) return null;
return { lines: toLines(Prism.tokenize(code, grammar), undefined, [[]]) };
},
};
A Shiki Highlighter
Shiki tokenizes with VS Code's TextMate grammars, and it can carry on from
where it stopped: codeToTokens returns the grammar's state at the end of the code, and takes one
to start from. This adapter hands that state back, so a block streaming in tokenizes only its new
lines. Shiki colors tokens from a theme, which CodeBlock doesn't use: includeExplanation says
which scopes each token is in, and the adapter maps them to CodeBlock's types, so the colors come
from Bulma. A language that isn't loaded returns null, and CodeBlock calls load, which loads it,
then tokenizes again.
import { createHighlighter, type BundledLanguage } from 'shiki';
import type {
CodeBlockHighlighter,
CodeBlockTokenType,
} from '@allxsmith/bestax-bulma';
const shiki = await createHighlighter({
themes: ['github-light'],
langs: ['tsx', 'bash'],
});
/** TextMate scopes, the more specific first, and the type each is in CodeBlock. */
const SCOPES: [string, CodeBlockTokenType][] = [
['comment', 'comment'],
['string', 'string'],
['constant.numeric', 'number'],
['keyword.operator', 'operator'],
['keyword', 'keyword'],
['storage', 'keyword'],
['constant.language', 'keyword'],
['entity.name.function', 'function'],
['support.function', 'function'],
['support.type.property-name', 'property'],
['variable.other.property', 'property'],
['entity.name.type', 'type'],
['support.type', 'type'],
['support.class', 'type'],
['entity.name.tag', 'tag'],
['entity.other.attribute-name', 'attribute'],
['punctuation', 'punctuation'],
['variable', 'variable'],
];
/** The type of the innermost scope that has one. */
function typeOf(scopes: { scopeName: string }[]) {
for (let i = scopes.length - 1; i >= 0; i--) {
const match = SCOPES.find(([prefix]) =>
scopes[i].scopeName.startsWith(prefix)
);
if (match) return match[1];
}
return undefined;
}
export const shikiHighlighter: CodeBlockHighlighter = {
tokenize(code, language, state) {
if (!shiki.getLoadedLanguages().includes(language)) return null;
const { tokens, grammarState } = shiki.codeToTokens(code, {
lang: language as BundledLanguage,
theme: 'github-light',
includeExplanation: 'scopeName',
grammarState: state as typeof grammarState,
});
return {
lines: tokens.map(line =>
line.flatMap(token =>
(token.explanation ?? [{ content: token.content, scopes: [] }]).map(
part => ({ content: part.content, type: typeOf(part.scopes) })
)
)
),
state: grammarState,
};
},
load: language => shiki.loadLanguage(language as BundledLanguage),
};
A Highlighter That Loads Languages
A highlighter's load(language) gets a language ready, such as by importing its grammar. CodeBlock
calls it after it renders, when tokenize returns null for the block's language, and tokenizes
again once it settles, once for each language and highlighter. Meanwhile the code renders plain, and it stays plain if load rejects or the
language is still unknown. With load given, the server render and the render that hydrates it are
plain too, so the page hydrates whichever languages the server had loaded.
Streaming
Set isStreaming while the code is still arriving, such as a fenced block in a chat reply that the
markdown renderer hands over before its closing fence. The block carries aria-busy, so a screen
reader doesn't read each change, and holds the copy button until the stream ends. While the code
only grows, CodeBlock keeps the lines it has tokenized and tokenizes only the new ones, plus the
last line, which may still be growing, from the state at the end of the line before. A highlighter
that hands back no state is given the whole code each time.
import type { CodeBlockTokenize } from '@allxsmith/bestax-bulma'; function example() { const source = `import { createServer } from 'node:http'; // Answers every request with the same line const server = createServer((req, res) => { res.end('Hello from bestax'); }); server.listen(3000);`; const [length, setLength] = useState(source.length); const [tokenize] = useState(() => { const tokenizeLines: CodeBlockTokenize = code => ({ state: null, lines: code.split('\n').map(line => line .split(/(\/\/.*|'[^']*'|\b(?:const|import|from)\b|\b\d+\b)/) .filter(Boolean) .map(content => ({ content, type: content.startsWith('//') ? 'comment' : content.startsWith("'") ? 'string' : /^\d+$/.test(content) ? 'number' : /^(const|import|from)$/.test(content) ? 'keyword' : undefined, })) ), }); return tokenizeLines; }); useEffect(() => { if (length >= source.length) return; const timer = setTimeout(() => setLength(n => n + 4), 30); return () => clearTimeout(timer); }, [length, source.length]); return ( <> <Button size="small" mb="3" onClick={() => setLength(0)}> Stream it again </Button> <CodeBlock title="server.js" language="js" highlighter={tokenize} code={source.slice(0, length)} isStreaming={length < source.length} /> </> ); }
File Tabs
Code in several files reads well as Tabs over a CodeBlock per file: the tabs are a
real tab list, so the arrow keys move between them, and each panel's block keeps its own copy
button.
<Tabs> <Tabs.List> <Tabs.Tab index={0}>App.tsx</Tabs.Tab> <Tabs.Tab index={1}>main.tsx</Tabs.Tab> </Tabs.List> <Tabs.Content> <Tabs.Content.Item index={0}> <CodeBlock language="tsx" code={`export function App() { return <Title>Hello</Title>; }`} /> </Tabs.Content.Item> <Tabs.Content.Item index={1}> <CodeBlock language="tsx" code={`import { createRoot } from 'react-dom/client'; import { App } from './App'; createRoot(document.getElementById('root')!).render(<App />);`} /> </Tabs.Content.Item> </Tabs.Content> </Tabs>
Accessibility
- A tab stop while it overflows: the code is a
Pre, so while a line runs past the edge, or the code pastmaxHeight, it's a tab stop the arrow keys scroll, Safari included, and aregionnamed by thetitle, or by the language label without one, or by the language itself with the label hidden too. While it fits, it's a plain<pre>with no tab stop, so a page of short blocks adds no landmarks. The root is a plain<div>. - The code is text: tokens render as text in CodeBlock's own classes, never as HTML, so code holding markup shows that markup rather than running it.
- Copy: an icon-only
CopyButtonnamed "Copy code", which announces the copy, or its failure, through its own polite status region. While there's nothing to copy or the code is streaming it's held:aria-disabledand drawn disabled, and a press does nothing, but it stays focusable, so a block that starts streaming doesn't drop the focus of someone on it. - Wrap: a
ToggleButtonnamed "Wrap lines", which says whether it's on througharia-pressed. - Line numbers and diff markers stay out of the text: they're CSS generated content with empty
alternative text and
user-select: none, so they're neither copied nor read out. - Highlighted and diff lines aren't color alone: they're
<mark>,<ins>and<del>, which some screen readers announce, and added and removed lines carry a+or a-, and a highlighted line a bar at its start. - Contrast: token colors come from Bulma's
*-on-schemecolors, neverprimary, and line numbers are in the text color, since Bulma's weak text color reads under 4.5:1 on the code background. A test holds every token color, the code's color and the line numbers to 4.5:1 on the code background and on each line background, in light and dark. - Left to right: the code is always
dir="ltr", while the header follows the page. - Streaming: the block carries
aria-busywhileisStreamingis set, so a screen reader isn't told about each token as it arrives. - Forced colors: tokens take the system's text color, a highlighted line is drawn in
MarkandMarkText, and the diff markers tell added and removed lines apart.
Related Components
Pre: The plain preformatted block it renders its code through.Code: Code inside a sentence.CopyButton: The copy button, for a copy field of your own.ToggleButton: The wrap toggle.Tabs: Tabs over a block per file.ConfigProvider: Sets the highlighter for every block inside.- Helper Props: Bulma helper props for spacing, color, etc.
Additional Resources
Props
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes to apply. |
code | string | — | Required. The code, rendered as text and never as HTML. A line break at the very end isn't drawn as a line of its own. |
language | string | — | The language's name, such as tsx. It's what the highlighter is asked to tokenize and the label's text. Without one, nothing is tokenized. |
title | React.ReactNode | — | A caption, such as a file name, at the start of the header. It names the code, which is a region a keyboard can scroll while its lines run past the edge. Without one, the language label names it, and with that hidden too, the language. |
showLanguage | boolean | true | Shows language in the header. |
showLineNumbers | boolean | false | Shows each line's number beside it, kept out of a copy and out of what a screen reader reads. |
startLine | number | 1 | The first line's number, for an excerpt that starts partway through a file. |
wrap | boolean | — | Whether long lines wrap, when you hold the state. Setting it makes the wrapping controlled: the wrap toggle only calls onWrapChange, and nothing changes until you pass the new value. Unwrapped, a long line runs past the edge, and the code scrolls sideways. |
defaultWrap | boolean | false | Whether long lines wrap to begin with, when the block holds the state. |
onWrapChange | (wrap: boolean) => void | — | Called with the new state each time the wrap toggle is pressed. |
showWrapToggle | boolean | false | Adds a toggle to the header that wraps and unwraps long lines. |
showCopyButton | boolean | true | Adds a button to the header that copies code, without one line break at its very end, so a pasted command doesn't run as it lands. It's held while that leaves nothing to copy or the code is streaming: drawn disabled and aria-disabled, and a press does nothing, but it stays focusable, so a block that starts streaming doesn't drop the focus of someone on its button. |
highlightLines | number[] | — | Lines to highlight, counting the code's own lines from 1 whatever startLine is. Each is a <mark>. A line also in addedLines or removedLines is drawn as that instead. |
addedLines | number[] | — | Lines added in a diff, counting from 1 like highlightLines. Each is an <ins>, with a + beside it that's kept out of a copy and out of what a screen reader reads. A line in both addedLines and removedLines is added. |
removedLines | number[] | — | Lines removed in a diff, counting from 1 like highlightLines. Each is a <del>, with a - beside it, kept out of a copy and out of what a screen reader reads. |
maxHeight | number | string | — | The height the code grows to, then scrolls past. A number is pixels, and a string is any CSS length. The header stays above it. |
highlighter | { tokenize: CodeBlockTokenize; load?: (language: string) => Promise<unknown> } | CodeBlockTokenize | null | — | Tokenizes the code: a highlighter object, or its tokenize function on its own. null renders plain text. Left out, it's the ConfigProvider's codeHighlighter, and without one the code renders plain. Pass one that stays the same from render to render, defined at module scope or in a useMemo: CodeBlock remembers the lines it tokenized, and the languages it loaded, only while it's the same highlighter, so a tokenize written inline tokenizes the whole code, and tries load again, every render. A plain object is the same while its tokenize is, and a class instance is its own: another instance of the class starts over. Code with a line over 5,000 characters, such as minified code, renders plain without a call to it. |
isStreaming | boolean | false | Set while the code is still arriving, such as in a chat reply. The block says it's busy through aria-busy, so a screen reader doesn't read each change, and holds the copy button until it's cleared. While the code only grows, streaming or not, the lines already tokenized are kept and only new ones are tokenized, when the highlighter's tokenize returns a state. When it doesn't, the whole code is tokenized each time. |
size | 'small' | 'medium' | 'large' | — | Sizes the code, the header and its buttons together. |
actions | React.ReactNode | — | More buttons for the header, placed before the wrap toggle and the copy button. |
labels | { copy?: string; copiedStatus?: string; failedStatus?: string; wrap?: string } | — | Translations for the buttons' names and the copy's announcements. |
textColor | Bulma color | 'inherit' | 'current' | — | Text color helper. |
bgColor | Bulma color | 'inherit' | 'current' | — | Background color helper. |
ref | React.Ref<HTMLDivElement> | — | Ref forwarded to the root <div>. |
... | All standard <div> attributes and Bulma helper props | — | See Helper Props |
Types:
CodeBlockToken: A run of text in one line of code, and what it is. Its fields:content:string— Required. The text, rendered as text, never as HTML.type:CodeBlockTokenType— What the text is, which picks its color. Without one, or with a type CodeBlock doesn't know, the text renders in the code's own color.
CodeBlockTokenType:'keyword'|'string'|'number'|'comment'|'function'|'type'|'property'|'tag'|'attribute'|'operator'|'punctuation'|'variable'— What a token is, which picks its color: each has a class of CodeBlock's own,code-block-token-<type>, colored by a--bulma-code-block-token-<type>-colorvariable.CodeBlockTokenize:( code: string, language: string, state?: unknown ) => CodeBlockTokenizeResult | null— Splits code in a language into lines of typed tokens, or returnsnullfor a language it doesn't know, which renders the code plain. It's called while CodeBlock renders, so it must not wait on anything: a language that loads later goes in the highlighter'sload.stateis what an earlier call returned for the lines before this code, orundefinedat the start.CodeBlockTokenizeResult: What a highlighter'stokenizereturns for the code it was given. Its fields:lines:CodeBlockToken[][]— Required. The tokens of each line of the code, one array per line and in order, so there are as many as the code has lines. A line's tokens together hold its text, without the newline that ends it. A result with a different number of lines renders that code plain.state:unknown— Where the grammar stopped at the end of the code, such as inside a block comment. CodeBlock hands it back with the lines that follow, so as the code grows, while it streams in, only the new lines are tokenized. Return one,nullincluded, whenever lines tokenized from it come out as they would inside the whole code, such as when no line depends on the ones before it. Left out, CodeBlock tokenizes the whole code each time it changes.
CSS & Sass Variables
CodeBlock registers these variables on its own .code-block element. Override them there (or via className) — a value set on an ancestor is only inherited, and loses to the component-level declaration. See Theme.
| CSS Variable | Sass Variable | Default |
|---|---|---|
--bulma-code-block-background | $code-block-background | var(--bulma-pre-background) |
--bulma-code-block-color | $code-block-color | var(--bulma-pre) |
--bulma-code-block-radius | $code-block-radius | var(--bulma-radius) |
--bulma-code-block-padding-block | $code-block-padding-block | 1.25em |
--bulma-code-block-padding-inline | $code-block-padding-inline | 1.5em |
--bulma-code-block-header-padding | $code-block-header-padding | 0.5em 0.75em |
--bulma-code-block-header-gap | $code-block-header-gap | 0.5em |
--bulma-code-block-actions-gap | $code-block-actions-gap | 0.25em |
--bulma-code-block-header-border-width | $code-block-header-border-width | 1px |
--bulma-code-block-header-border-color | $code-block-header-border-color | var(--bulma-border) |
--bulma-code-block-title-weight | $code-block-title-weight | var(--bulma-weight-semibold) |
--bulma-code-block-language-font-size | $code-block-language-font-size | 0.875em |
--bulma-code-block-line-number-color | $code-block-line-number-color | var(--bulma-code-block-color) |
--bulma-code-block-gutter-gap | $code-block-gutter-gap | 2ch |
--bulma-code-block-gutter-border-width | $code-block-gutter-border-width | 1px |
--bulma-code-block-gutter-border-color | $code-block-gutter-border-color | var(--bulma-border) |
--bulma-code-block-highlight-background | $code-block-highlight-background | hsl(var(--bulma-info-h), var(--bulma-info-s), calc(var(--bulma-background-l) - 3%)) |
--bulma-code-block-highlight-border-width | $code-block-highlight-border-width | 0.25em |
--bulma-code-block-highlight-border-color | $code-block-highlight-border-color | var(--bulma-info-on-scheme) |
--bulma-code-block-added-background | $code-block-added-background | hsl(var(--bulma-success-h), var(--bulma-success-s), calc(var(--bulma-background-l) - 3%)) |
--bulma-code-block-removed-background | $code-block-removed-background | hsl(var(--bulma-danger-h), var(--bulma-danger-s), calc(var(--bulma-background-l) - 3%)) |
--bulma-code-block-token-keyword-color | $code-block-token-keyword-color | var(--bulma-link-on-scheme) |
--bulma-code-block-token-string-color | $code-block-token-string-color | var(--bulma-success-on-scheme) |
--bulma-code-block-token-number-color | $code-block-token-number-color | var(--bulma-warning-on-scheme) |
--bulma-code-block-token-comment-color | $code-block-token-comment-color | var(--bulma-text) |
--bulma-code-block-token-comment-font-style | $code-block-token-comment-font-style | italic |
--bulma-code-block-token-function-color | $code-block-token-function-color | var(--bulma-info-on-scheme) |
--bulma-code-block-token-type-color | $code-block-token-type-color | var(--bulma-info-on-scheme) |
--bulma-code-block-token-property-color | $code-block-token-property-color | var(--bulma-code-block-color) |
--bulma-code-block-token-tag-color | $code-block-token-tag-color | var(--bulma-danger-on-scheme) |
--bulma-code-block-token-attribute-color | $code-block-token-attribute-color | var(--bulma-danger-on-scheme) |
--bulma-code-block-token-operator-color | $code-block-token-operator-color | var(--bulma-code-block-color) |
--bulma-code-block-token-punctuation-color | $code-block-token-punctuation-color | var(--bulma-code-block-color) |
--bulma-code-block-token-variable-color | $code-block-token-variable-color | var(--bulma-code-block-color) |