-
Notifications
You must be signed in to change notification settings - Fork 7
Code
Giorgio Garofalo edited this page Oct 14, 2024
·
9 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
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.code
in combination with.read
to 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
); -
.code
elements define their language through the optionallang
argument (e.g..code {markdown}
or.code lang:{markdown}
)
- Standard code blocks always show line numbers by default;
-
.code
allows toggling line numbers via the optionallinenumbers
Boolean
argument, 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;
}
}
- Syntax of a function call
- Declaring functions
- Dynamic typing
- Localization
- Including other Quarkdown files
- Importing external libraries
- Document metadata
- Theme
- Page format
- Page margin content
- Page counter
- Automatic page break
- Numbering
- Table of contents
- Stacks (row, column, grid)
- Align
- Container
- Box
- Collapsible
- Whitespace
- String
- Number
- Markdown content
- Boolean
- Enumeration entry
- Iterable
- Dictionary
- Range
- Lambda
- Size(s)
- Color
- Dynamic