-
-
Notifications
You must be signed in to change notification settings - Fork 212
Code
Giorgio Garofalo edited this page Oct 18, 2025
·
11 revisions
A block of code can be created as the standard Markdown specification allows, by either a 4-spaces/1-tab indentation or a delimitation of 3 backticks/tildes.
However, Quarkdown also provides a more powerful .code[docs] block function, so what's the difference?
- Standard code blocks don't allow any processing of their content, which is instead rendered as-is;
-
.code's body parameter accepts any Quarkdown string, making it possible to evaluate functions before displaying their output as code.
This can be extremely useful when using.codein combination with.readto load a code snippet from file:.code .read {Point.java}
- Standard fenced code blocks define their language right after the starter delimiter (e.g.
```markdown); -
.codeelements define their language through the optionallangargument (e.g..code {markdown}or.code lang:{markdown})
- Standard code blocks always show line numbers by default;
-
.codeallows toggling line numbers via the optionallinenumbersBooleanargument, which defaults totrue.
.code allows focusing a Range of lines (beginning from 1).
Line numbers are required to be enabled in order for this to work, due to the internal implementation.
.code {java} focus:{8..10}
public final class Wrapper<T> {
private final T value;
public Wrapper(T value) {
this.value = value;
}
public final T getValue() {
return this.value;
}
}
Alongside with .code as a dynamic alternative to triple backticks (```),
.codespan {text} can be used as a dynamic alternative to inline backticks (`text`), allowing function calls within its content.
- Figures
- Image size
- TeX formulae
- Table caption
- Code caption
- Decorative headings
- Alerts (quote types)
- Quotation source
- Cross-references
- Page breaks
- Text symbols (text replacement)
- Emojis
- Document metadata
- Theme
- CSS
- Fonts
- Page format
- Page margin content
- Page counter
- Persistent headings
- Automatic page break
- Numbering
- Paragraph style
- Caption position
- Table of contents
- Bibliography
- Footnotes
- Stacks (row, column, grid)
- Container
- Align
- Float
- Figure
- Clip
- Box
- Collapsible
- Landscape
- Whitespace
- Variables
- Optionality
- Math
- Conditional statements
- Loops
- Let
- Destructuring
- String manipulation
- Table manipulation: sorting, computing, and more
- Table generation
- String
- Number
- Markdown content
- Boolean
- None
- Enumeration entry
- Iterable
- Dictionary
- Range
- Lambda
- Size(s)
- Color
- Dynamic
- Paper: abstract, definitions, theorems, and more