Description
Code
Kind | Link |
---|---|
Reference | https://mystmd.org/guide/directives#directive-code |
Documentation | https://mystmd.org/guide/code |
A code-block environment with a language as the argument, and options for highlighting, showing line numbers, and an optional filename.
Implementation
- Parses directives and aliases
- Emits HTML
- Unit tests
- Validation (emits, warnings and errors).
Specification compliance:
- Arguments is not parsed and treated as language option
- Body is not parsed and treated as raw string
- Options:
-
label, name
(string) - Label the code to be cross-referenced or explicitly linked to. -
enumerated, numbered
(boolean) - Turn on/off the numbering for the specific code -
enumerator, number
(string) - Explicitly set the code number -
class
(string) -
caption
(parsed) - A parsed caption for the code block. -
linenos
(boolean)- Show line numbers -
lineno-start
(number) - Start line numbering from a particular value, default is 1. If present, line numbering is activated. -
number-lines
(number)
Alternative for “lineno-start”, turns on line numbering and can be an integer that is the start of the line numbering. -
emphasize-lines
(string) - Emphasize particular lines (comma-separated numbers), e.g. “3,5” -
filename
(string)
Show the filename in addition to the rendered code. The include directive will use the filename by default, to turn off this default set the filename to false.
-
- Aliases:
-
code-block
-
sourcecode
-