Code
Syntax-highlighted code block and folder explorer.
Group multiple code blocks into an IDE-like folder explorer.
Use a single code block for short examples.
Usage#
Code Block#
Write a fenced code block with a language for syntax highlighting.
Header#
Add a filename in square brackets to show a header, or omit it for a headerless block.
Line Numbers#
Set lineNumbers=true to show line numbers.
Line Highlights & Diffs#
Use added, deleted, and highlighted ranges to highlight particular lines.
Compact#
Set compact=true to align the block's borders with the text column without changing its inner padding. This only affects standalone blocks on desktop.
Code Group#
Wrap related code blocks in CodeBlockGroup. File paths dictate the folder structure.
Set the group's lineNumbers to true to enable numbers for every file, or false to hide them. Each fence keeps its own annotation ranges.
Code Block Reference#
filenameDefaultundefinedstringFile path shown in the header. Omit for a headerless block.
languageDefaultundefinedstringSyntax-highlighting language. Omit for plain text.
lineNumbersDefaultfalsebooleanShow line numbers. A group controls this for all its files.
compactDefaultfalsebooleanAlign borders with the content column without changing inner padding. Only affects standalone blocks on desktop.
addedDefaultundefinedstringOne-based line ranges tinted with the
positivecolor role.
deletedDefaultundefinedstringOne-based line ranges tinted with the
negativecolor role. Text remains available for copying.
highlightedDefaultundefinedstringOne-based line ranges tinted with the
accentcolor role. Each line can have only one annotation.
Code Group Reference#
lineNumbersDefaultfalsebooleanDisplay line numbers for every fence in the group.