Skip to content

Code ​

Open a code block with three or more backticks at the start of a line. Close it with a line that contains at least the same number of backticks.

Basic Code Block ​

sevenmark
```
function hello() {
    console.log("Hello, World!");
}
```

Parameters ​

Put parameters after the opening fence. Set #lang to select syntax highlighting. Use shared style parameters to change the block appearance.

sevenmark
``` #lang="rust"
fn main() {
    println!("Hello, world!");
}
```

``` #lang="python" #class="example-code"
def greet(name):
    return f"Hello, {name}!"
```

Parameters may also span multiple lines before the code body:

sevenmark
```
#lang="javascript"
#class="example-code"
console.log("Hello");
```

Fence Length ​

If the code itself contains a triple-backtick fence, use a longer outer fence.

sevenmark
```` #lang="markdown"
```rust
fn main() {}
```
````

Namumark Syntax Blocks ​

SevenMark also accepts NamuMark #!syntax blocks as syntax sugar and maps them to the same Code AST as fenced code blocks:

sevenmark
{{{#!syntax rust
fn main() {}
}}}

The formatter normalizes this form back to SevenMark fenced code syntax.

Inline Code ​

Inline code uses matching backtick runs and does not cross line breaks:

sevenmark
Use `parse_document()` to parse source text.
Use ``one ` tick`` when the content contains a backtick.

Notes ​

  • The old {{{#code ...}}} form is no longer code syntax.
  • Fenced code blocks are raw: markup inside the code body is not parsed.
  • Opening and closing fences must start at column 0. Closing fences may use more backticks than the opener.