Extra syntect syntaxes and themes curated by the bat project
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-01-01 04:25:16 -07:00
.cargo Initial implementation 2023-07-02 11:36:33 -06:00
.github add redirect PR template 2026-01-01 04:25:16 -07:00
assets Tweak generated README text 2024-07-07 14:32:40 -06:00
bat@979ba22628 feat: sync with bat 979ba22 2025-12-08 23:04:36 -07:00
fuzz chore(deps): bump arbitrary from 1.4.1 to 1.4.2 2025-08-18 20:21:11 -06:00
generated feat: remove Visual Studio Dark+ theme 2025-12-24 22:17:40 -07:00
patches refactor: Allow for patching on top of bats patches 2024-04-27 02:17:55 -06:00
src docs: switch theme code example 2025-12-28 04:12:16 -07:00
tests docs: switch theme code example 2025-12-28 04:12:16 -07:00
xtask feat: remove Visual Studio Dark+ theme 2025-12-24 22:17:40 -07:00
.gitignore chore: Commit the Cargo.lock 2024-04-29 21:39:24 -06:00
.gitmodules Initial implementation 2023-07-02 11:36:33 -06:00
Cargo.lock release: prepare 0.5.1 release 2025-12-25 00:15:22 -07:00
Cargo.toml release: prepare 0.5.1 release 2025-12-25 00:15:22 -07:00
CHANGELOG.md release: prepare 0.5.1 release 2025-12-25 00:15:22 -07:00
codecov.yml chore: Disable codecov bot (#10) 2024-04-25 01:09:11 -05:00
LICENSE-APACHE docs: tidy up some docs 2025-12-24 23:32:23 -07:00
LICENSE-MIT docs: tidy up some docs 2025-12-24 23:32:23 -07:00
README.md goodbye github 👋 2026-01-01 04:18:45 -07:00
RELEASE.md docs: Update docs on finding MSRV 2025-01-26 16:55:20 -07:00
SECURITY.md docs(security): Create SECURITY.md 2024-05-04 01:37:32 -05:00

Important

Moved to codeberg. Issues still open here for people who want to use them :)

https://codeberg.org/CosmicHarper/two-face


two-face — regex lover club 🐭

build status Crates.io Documentation codecov

Extra syntax and theme definitions for syntect including many common ones that are missing from the default set like TOML, TypeScript, and Dockerfile. Curated by the bat Project

Example

The following

$ cargo add two-face --features syntect-default-onig
use two_face::re_exports::syntect;

const TOML_TEXT: &str = "\
[section]
key = 123
";

fn main() {
    let syn_set = two_face::syntax::extra_newlines();
    let theme_set = two_face::theme::extra();

    let syn_ref = syn_set.find_syntax_by_extension("toml").unwrap();
    let theme = &theme_set[two_face::theme::EmbeddedThemeName::Nord];
    let htmlified = syntect::html::highlighted_html_for_string(
        TOML_TEXT,
        &syn_set,
        syn_ref,
        theme
    ).unwrap();

    println!("{htmlified}");
}

will print this

<pre style="background-color:#2e3440;">
<span style="color:#d8dee9;">[section]
</span><span style="color:#81a1c1;">key </span><span style="color:#d8dee9;">= </span><span style="color:#b48ead;">123
</span></pre>

Feature Flags

The feature flags are divided by syntect's underlying regex implementation with Oniguruma aka onig being the default and fancy-regex aka fancy as an alternative pure-Rust implementation. fancy: however, doesn't support all of the features used by some of the syntax definitions, so some of the defintions are excluded when fancy is selected* to keep the regex compilation infallible. This means that it's important to match whichever regex implementation syntect is using

* This is also why fancy's bundled syntax definitions are smaller than onig's

default: syntect-onig

Feature Desc.
syntect-onig / syntect-fancy Enables the minimal feature set that we require from syntect
syntect-default-onig / syntect-default-fancy The mimimal feature sets along with syntect's default feature set (useful when using the syntect re-export)

Embedded Asset Sizes

This crate embeds some reasonably large assets in the final binary in order to work. Luckily the linker is smart enough to discard unused assets, so you generally only pay for what you use

For reference here are the sizes associated with their different functions

function two-face (KiB) syntect (KiB)
acknowledgement::listing() 11 -
syntax::extra_newlines() (onig) 961 360
^^ (fancy) 937 ^^
syntax::extra_no_newlines() (onig) 959 359
^^ (fancy) 935 ^^
theme::extra() 61 5

In short the syntax definitions are the real chonky part, and if you're switching from syntect to two-face, then you can expect a ~0.6MiB increase in binary size from them (in exchange for a lot of syntax definitions)

Syntaxes

The full listing of all syntaxes included in two_face::syntax

  • * Excluded when using the fancy-regex implementation
  • † Included in syntect's bundled defaults
Syntax Definition
A ActionScript†, Ada, Apache Conf, AppleScript†, AsciiDoc, ASP†, ARM Assembly*, Assembly (x86_64), AWK
B Bash†, Batch File†, BibTeX†
C C†, C#†, C++†, Cabal, CFML, Clojure†, CMake, CoffeeScript, Crontab, Crystal, CSS†, CSV†
D D†, Dart, debsources, Dockerfile, DotENV, Diff†
E Elixir, Elm, Email, Erlang†
F F#, Fish, Fortran
G GDScript (Godot Engine), Git (commit, config, ignore, etc.)†, GLSL, Go†, GraphQL, Graphviz (DOT)†, Groff/troff†, Groovy†
H Haskell†, HTML†
I Idris, INI
J Java†, Javadoc†, Java Server Page (JSP)†, JavaScript†, JavaScript (Babel)*, Jinja2, JQ, JSON†, Julia
K Kotlin
L LaTeX†, LaTeX Log†, Lean, LESS, Lisp†, Literate Haskell†, LiveScript, LLVM, Lua†
M Makefile†, Manpage, Markdown†, MATLAB†, Mediawiki, MultiMarkdown†
N NAnt Build File†, Nginx, Nim, Ninja, Nix, NSIS
O Objective-C†, Objective-C++†, OCaml†, OCamllex†, OCamlyacc†, Odin, Org Mode
P Pascal†, Perl†, PHP†, PowerShell*, Protobuf, Puppet, PureScript, Python†
Q QML
R R†, Racket, Rd†, Rego, Regular Expression†, Requirements.txt, reStructuredText†, Robot Framework, Ruby†, Ruby Haml†, Ruby on Rails†, Ruby Slim, Rust†
S Sass, Scala†, SCSS, Salt State SLS*, SML, Solidity, SQL†, Strace, Stylus, Svelte, Swift, SystemVerilog
T Tcl†, Terraform, TeX†, Textile†, Todo.txt, TOML, TypeScript, TypescriptReact, Typst
V Varlink, Verilog, VHDL, VimL, Vue, Vyper
W WGSL
X XML†
Y YAML†
Z Zig

Themes

Note: For visual examples of all of the embedded themes look at the docs for two_face::theme::EmbeddedThemeName

The full listing of themes provided by two_face::theme. Many of these themes only make sense situationally, so you'll likely want to only expose a subset

  • † Included in syntect's bundled defaults
Theme
1 1337 (aka leet)
A Ansi
B Base16, Base16-256, Base16-Eighties (dark)†, Base16-Mocha (dark)†, Base16-Ocean (light/dark)†
C Catppuccin (frappe, latte, macchiato, mocha), Coldark (cold/dark aka light/dark)
D DarkNeon, Dracula
G GitHub, gruvbox (light/dark)
I InspiredGitHub†
M Monokai Extended (plain, bright, light, and origin)
N Nord
O One Half (light/dark)
S Solarized (light/dark)†, Sublime Snazzy
T TwoDark
Z Zenburn

Most of the code for generating the syntax and theme dumps along with curating said syntax and themes is taken from bat. Because of this we also mirror bat's licenses by being dual licensed under MIT and Apache-2.0.

See the LICENSE-APACHE and LICENSE-MIT files for license details.

The embedded syntax definitions and assets also have their own licenses which are compiled into this markdown file along with programmatic access in the acknowledgement module.

bat's NOTICE

Copyright (c) 2018-2021 bat-developers (https://github.com/sharkdp/bat).

bat is made available under the terms of either the MIT License or the Apache License 2.0, at your option.

See the LICENSE-APACHE and LICENSE-MIT files for license details.