Neko

Advanced Code Blocks and Highlighting

Neko Team

Advanced Code Blocks and Highlighting

Code is at the heart of technical documentation. Neko provides a powerful Code Block experience built on top of Highlight.js and Markdig.

Basic Syntax

Use standard Markdown triple backticks:

public void Hello()
{
    Console.WriteLine("Hello World");
}

Advanced Features

Line Numbers

You can enable line numbers globally in neko.yml or per block:

snippets:
  lineNumbers: ["csharp", "javascript"]

Or locally:

```csharp #
// Line numbers enabled

Highlighting Lines

Use the !# flag followed by line ranges to highlight specific lines.

public void HighlightMe()
{
    // This line is highlighted
    // And this one too
}

File Names

You can add a file name or title to your code block:

:::code source="Program.cs"
using System;
:::

Or using the standard syntax with title attribute (requires generic attribute extension support, or use the :::code component):

Program.cs
// Some code

Supported Languages

Neko supports over 180 languages via Highlight.js, including:

  • C#, F#, VB.NET
  • JavaScript, TypeScript
  • Python, Ruby, Go, Rust
  • HTML, CSS, XML, JSON, YAML
  • Bash, PowerShell, Dockerfile

Ensure your code samples look their best with Neko's syntax highlighting.