| Crates.io | autumnus |
| lib.rs | autumnus |
| version | 0.7.3 |
| created_at | 2025-02-14 19:48:07.510899+00 |
| updated_at | 2025-08-21 00:29:33.403759+00 |
| description | Syntax highlighter powered by Tree-sitter and Neovim themes. |
| homepage | https://autumnus.dev |
| repository | https://github.com/leandrocp/autumnus |
| max_upload_size | |
| id | 1555935 |
| size | 129,423,333 |
Autumnus is a syntax highlighter powered by Tree-sitter and Neovim themes. It provides beautiful and accurate syntax highlighting for over 50 programming languages with support for over 100 themes.
Add Autumnus to your Cargo.toml:
[dependencies]
autumnus = "0.3"
By default, Autumnus includes support for all languages, which can result in longer compilation times. You can reduce compilation time and binary size by enabling only the languages you need:
[dependencies]
autumnus = { version = "0.3", default-features = false, features = ["lang-rust", "lang-javascript", "lang-python"] }
Available language features:
lang-angular - Angular templateslang-asm - Assemblylang-astro - Astro frameworklang-bash - Bash/Shell scriptslang-c - C programming languagelang-clojure - Clojurelang-cmake - CMake build fileslang-comment - Comment highlightinglang-commonlisp - Common Lisplang-cpp - C++lang-csharp - C#lang-css - CSS stylesheetslang-csv - CSV fileslang-dart - Dartlang-diff - Diff/patch fileslang-dockerfile - Docker fileslang-eex - Elixir EEx templateslang-ejs - EJS templateslang-elixir - Elixirlang-elm - Elmlang-erb - ERB templateslang-erlang - Erlanglang-fsharp - F#lang-gleam - Gleamlang-glimmer - Glimmer/Handlebarslang-go - Golang-graphql - GraphQLlang-haskell - Haskelllang-hcl - HCL/Terraformlang-heex - Phoenix HEEx templateslang-html - HTMLlang-iex - Elixir IExlang-java - Javalang-javascript - JavaScriptlang-json - JSONlang-kotlin - Kotlinlang-latex - LaTeXlang-liquid - Liquid templateslang-llvm - LLVM IRlang-lua - Lualang-make - Makefileslang-markdown - Markdownlang-markdown-inline - Inline Markdownlang-nix - Nixlang-objc - Objective-Clang-ocaml - OCamllang-perl - Perllang-php - PHPlang-powershell - PowerShelllang-protobuf - Protocol Bufferslang-python - Pythonlang-r - Rlang-regex - Regular expressionslang-ruby - Rubylang-rust - Rustlang-scala - Scalalang-scss - SCSSlang-sql - SQLlang-surface - Phoenix Surfacelang-svelte - Sveltelang-swift - Swiftlang-toml - TOMLlang-tsx - TypeScript JSXlang-typescript - TypeScriptlang-vim - Vim scriptlang-vue - Vue.jslang-xml - XMLlang-yaml - YAMLlang-zig - ZigOr use the convenience feature to enable all languages:
[dependencies]
autumnus = { version = "0.3", features = ["all-languages"] }
Install the autumn command-line tool:
cargo install autumnus
For faster compilation, you can install the CLI with only the languages you need:
# Install with only specific languages
cargo install autumnus --no-default-features --features "lang-rust,lang-python,lang-javascript"
# Install with web development languages
cargo install autumnus --no-default-features --features "lang-html,lang-css,lang-javascript,lang-typescript,lang-json"
# Install with all languages (same as default)
cargo install autumnus --features "all-languages"
This can significantly reduce compilation time, especially on slower machines or CI environments.
Note: While the package name is autumnus, the installed binary is named autumn. This means you use cargo install autumnus to install it, but run it as autumn in your terminal.
use autumnus::{highlight, Options};
let code = r#"
function greet(name) {
console.log(`Hello ${name}!`);
}
"#;
let html = highlight("javascript", code, Options::default());
use autumnus::{highlight, Options, themes};
let code = "SELECT * FROM users WHERE active = true;";
let html = highlight(
"sql",
code,
Options {
theme: themes::get("dracula").expect("Theme not found"),
..Options::default()
}
);
use autumnus::{highlight, Options};
let code = r#"
defmodule MyApp do
def hello, do: :world
end
"#;
// Language will be automatically detected as Elixir from the .ex extension
let html = highlight("app.ex", code, Options::default());
use autumnus::{highlight, Options, FormatterOption};
let code = "puts 'Hello from Ruby!'";
let ansi = highlight(
"ruby",
code,
Options {
formatter: FormatterOption::Terminal,
..Options::default()
}
);
use autumnus::{highlight, Options, FormatterOption};
let code = "console.log('Hello!')";
let html = highlight(
"javascript",
code,
Options {
formatter: FormatterOption::HtmlLinked,
..Options::default()
}
);
When using FormatterOption::HtmlLinked, include the corresponding CSS file for your chosen theme:
<link rel="stylesheet" href="css/dracula.css" />
The autumn command-line tool provides several commands for syntax highlighting and code analysis:
autumn list-languages
Lists all supported programming languages and their associated file patterns.
autumn list-themes
Lists all available syntax highlighting themes.
autumn highlight <path> [options]
Highlights the contents of a file with syntax highlighting.
Options:
-f, --formatter <formatter>: Output format (default: terminal)
terminal: ANSI colored output for terminalhtml-inline: HTML output with inline styleshtml-linked: HTML output with linked stylesheet-t, --theme <theme>: Theme name (default: catppuccin_frappe)Example:
autumn highlight src/main.rs --formatter html-inline --theme github_dark
autumn highlight-source <source> [options]
Highlights a string of source code.
Options:
-l, --language <language>: Programming language for the source code-f, --formatter <formatter>: Output format (default: terminal)-t, --theme <theme>: Theme name (default: catppuccin_frappe)Example:
autumn highlight-source "println!(\"Hello World!\");" -l rust
autumn dump-tree-sitter <path>
Dumps the Tree-sitter AST (Abstract Syntax Tree) for a given file. This is useful for debugging or understanding how Tree-sitter parses your code.
Check the documentation for a complete list of supported languages and file extensions.
Autumnus includes over 100 themes, such as:
Check the documentation for a complete list of supported themes.
Contributions are welcome! Feel free to:
Autumnus would not be possible without these projects: