Block rule for the Wikidot code block: [[code]]...[[/code]].
A code block captures its body as raw text (no inline parsing) and
supports two optional attributes:
type -- the programming language for syntax highlighting (e.g.
type="python").
name -- a label or filename displayed alongside the code.
The content between the tags is collected verbatim, with a single
trailing newline stripped. The parsed block is also pushed into
ctx.codeBlocks so higher-level consumers can enumerate all code
blocks in the document.
Edge case: when a quoted attribute value swallows the ]] and even
the [[/code]] (e.g. [[code type="css]][[/code]]), the parser
detects this by inspecting the QUOTED_STRING token and truncates the
value at the first ]]. If [[/code]] is also inside the quoted
string, the body is treated as empty.
Block rule for the Wikidot code block:
[[code]]...[[/code]].A code block captures its body as raw text (no inline parsing) and supports two optional attributes:
type-- the programming language for syntax highlighting (e.g.type="python").name-- a label or filename displayed alongside the code.The content between the tags is collected verbatim, with a single trailing newline stripped. The parsed block is also pushed into
ctx.codeBlocksso higher-level consumers can enumerate all code blocks in the document.Edge case: when a quoted attribute value swallows the
]]and even the[[/code]](e.g.[[code type="css]][[/code]]), the parser detects this by inspecting the QUOTED_STRING token and truncates the value at the first]]. If[[/code]]is also inside the quoted string, the body is treated as empty.