Syntax Highlighting

undox provides syntax highlighting for 80+ programming languages using tree-sitter, the same parser used by GitHub, Neovim, and other modern editors.

Usage

Add a language identifier after the opening fence:

```rust
fn main() {
println!("Hello, world!");
}
```

Renders as:

fn main() {
println!("Hello, world!");
}

Supported Languages

Web Development

// JavaScript
const greeting = (name) => `Hello, ${name}!`;
export default greeting;
// TypeScript
interface User {
name: string;
age: number;
}
const greet = (user: User): string => `Hello, ${user.name}!`;
<!-- HTML -->
<!DOCTYPE html>
<html>
<head><title>Hello</title></head>
<body>
<h1>Welcome</h1>
</body>
</html>
/* CSS */
.container {
display: flex;
justify-content: center;
background: linear-gradient(to right, #667eea, #764ba2);
}

Systems Programming

// Rust
use std::collections::HashMap;
fn main() {
let mut scores: HashMap<&str, i32> = HashMap::new();
scores.insert("Blue", 10);
println!("{:?}", scores);
}
// Go
package main
import "fmt"
func main() {
messages := make(chan string)
go func() { messages <- "ping" }()
fmt.Println(<-messages)
}

Scripting

# Python
def fibonacci(n: int) -> list[int]:
fib = [0, 1]
for i in range(2, n):
fib.append(fib[i-1] + fib[i-2])
return fib
print(fibonacci(10))
#!/bin/bash
# Bash
for file in *.md; do
echo "Processing $file"
wc -l "$file"
done

Data Formats

{
"name": "undox",
"version": "0.1.0",
"features": ["markdown", "syntax-highlighting", "multi-repo"]
}
# YAML
site:
name: "My Docs"
url: "https://example.com"
sources:
- name: docs
path: ./content

Full Language List

undox supports these languages (and their common aliases):

LanguageIdentifiers
Bashbash, sh, shell
Cc
C++cpp, c++
C#csharp, cs
CSScss
Diffdiff
Elixirelixir
Erlangerlang
Gogo, golang
Haskellhaskell, hs
HTMLhtml
Javajava
JavaScriptjavascript, js
JSONjson
Kotlinkotlin, kt
Lualua
Markdownmarkdown, md
Nixnix
OCamlocaml
PHPphp
Pythonpython, py
Rubyruby, rb
Rustrust, rs
Scalascala
SQLsql
Swiftswift
TypeScripttypescript, ts
TSXtsx
XMLxml
YAMLyaml, yml
Zigzig

...and 50+ more!

No Language Specified

Code blocks without a language identifier are rendered without highlighting:

This is plain text
No syntax highlighting applied

Theme

Syntax highlighting uses a GitHub Dark inspired color scheme that works well on both light and dark backgrounds.