1. Full blocks of code 🔗

NML supports different kind of code blocks. The full block modes creates a (optionally titled), numbered code block. You can also specify the language of the block to get proper highlighting via the syntect crate.

Example:

The following...

```C, Factorial in C
int factorial(int n)
{
	if (n <= 1)
		return 1;
	return n * factorial(n - 1);
}
```

...gives the following

Factorial in C
1
int factorial(int n)
2
{
3
	if (n <= 1)
4
		return 1;
5
	return n * factorial(n - 1);
6
}

Properties 🔗

2. Mini blocks 🔗

Mini blocks are code blocks that can span on a single line (thus blending within a paragraph).

Example:

Mini blocks can span multiple lines, in which case they become similar to full code blocks with the following differences:

  1. No title: Mini blocks cannot have a title at all
  2. No line numbers: Line numbers won't be shown

Example:

The following...

``Rust
fn real_position(
	source: Rc<dyn Source>,
	position: usize
) -> (Rc<dyn Source>, usize)
{
	if let Some(parent) = source.parent
	{
		return real_position(parent.clone(), source.apply_offsets(position));
	}
	return (source.clone(), source.apply_offsets(position));
}
``

...gives the following

fn real_position(
	source: Rc<dyn Source>,
	position: usize
) -> (Rc<dyn Source>, usize)
{
	if let Some(parent) = source.parent
	{
		return real_position(parent.clone(), source.apply_offsets(position));
	}
	return (source.clone(), source.apply_offsets(position));
}

3. Code theme 🔗

Code theme can be controlled by the variable code.theme. The default value is base16-ocean.dark. According to syntect's documentation, the following themes are available: