inkjet 0.11.1

A batteries-included syntax highlighting library for Rust, based on tree-sitter.
Documentation
//! Common constants.

/// The names recognized by `tree-sitter` when querying the parse tree during highlighting.
///
/// Sourced from the [Helix](https://docs.helix-editor.com/themes.html#scopes) project.
pub const HIGHLIGHT_NAMES: &[&str] = &[
    "attribute",
    "type",
    "type.builtin",
    "type.enum",
    "type.enum.variant",
    "constructor",
    "constant",
    "constant.builtin",
    "constant.builtin.boolean",
    "constant.character",
    "constant.character.escape",
    "constant.numeric",
    "constant.numeric.integer",
    "constant.numeric.float",
    "string",
    "string.regexp",
    "string.special",
    "string.special.path",
    "string.special.url",
    "string.special.symbol",
    "escape",
    "comment",
    "comment.line",
    "comment.block",
    "comment.block.documentation",
    "variable",
    "variable.builtin",
    "variable.parameter",
    "variable.other",
    "variable.other.member",
    "label",
    "punctuation",
    "punctuation.delimiter",
    "punctuation.bracket",
    "punctuation.special",
    "keyword",
    "keyword.control",
    "keyword.control.conditional",
    "keyword.control.repeat",
    "keyword.control.import",
    "keyword.control.return",
    "keyword.control.exception",
    "keyword.operator",
    "keyword.directive",
    "keyword.function",
    "keyword.storage",
    "keyword.storage.type",
    "keyword.storage.modifier",
    "operator",
    "function",
    "function.builtin",
    "function.method",
    "function.macro",
    "function.special",
    "tag",
    "tag.builtin",
    "namespace",
    "special",
    "markup",
    "markup.heading",
    "markup.heading.marker",
    "markup.heading.1",
    "markup.heading.2",
    "markup.heading.3",
    "markup.heading.4",
    "markup.heading.5",
    "markup.heading.6",
    "markup.list",
    "markup.list.unnumbered",
    "markup.list.numbered",
    "markup.list.checked",
    "markup.list.unchecked",
    "markup.bold",
    "markup.italic",
    "markup.strikethrough",
    "markup.link",
    "markup.link.url",
    "markup.link.label",
    "markup.link.text",
    "markup.quote",
    "markup.raw",
    "markup.raw.inline",
    "markup.raw.block",
    "diff",
    "diff.plus",
    "diff.minus",
    "diff.delta",
    "diff.delta.moved"
];

/// The same as [`HIGHLIGHT-NAMES`](crate::constants::HIGHLIGHT_NAMES), but with all dots replaced with spaces.
/// 
/// These names are used for CSS classes in the builtin [HTML formatter](crate::formatter::Html).
pub const HIGHLIGHT_CLASS_NAMES: &[&str] = &[
    "attribute",
    "type",
    "type builtin",
    "type enum",
    "type enum variant",
    "constructor",
    "constant",
    "constant builtin",
    "constant builtin boolean",
    "constant character",
    "constant character escape",
    "constant numeric",
    "constant numeric integer",
    "constant numeric float",
    "string",
    "string regexp",
    "string special",
    "string special path",
    "string special url",
    "string special symbol",
    "escape",
    "comment",
    "comment line",
    "comment block",
    "comment block documentation",
    "variable",
    "variable builtin",
    "variable parameter",
    "variable other",
    "variable other member",
    "label",
    "punctuation",
    "punctuation delimiter",
    "punctuation bracket",
    "punctuation special",
    "keyword",
    "keyword control",
    "keyword control conditional",
    "keyword control repeat",
    "keyword control import",
    "keyword control return",
    "keyword control exception",
    "keyword operator",
    "keyword directive",
    "keyword function",
    "keyword storage",
    "keyword storage type",
    "keyword storage modifier",
    "operator",
    "function",
    "function builtin",
    "function method",
    "function macro",
    "function special",
    "tag",
    "tag builtin",
    "namespace",
    "special",
    "markup",
    "markup heading",
    "markup heading marker",
    "markup heading 1",
    "markup heading 2",
    "markup heading 3",
    "markup heading 4",
    "markup heading 5",
    "markup heading 6",
    "markup list",
    "markup list unnumbered",
    "markup list numbered",
    "markup list checked",
    "markup list unchecked",
    "markup bold",
    "markup italic",
    "markup strikethrough",
    "markup link",
    "markup link url",
    "markup link label",
    "markup link text",
    "markup quote",
    "markup raw",
    "markup raw inline",
    "markup raw block",
    "diff",
    "diff plus",
    "diff minus",
    "diff delta",
    "diff delta moved",
];

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn equivalence() {
        for i in 0..HIGHLIGHT_NAMES.len() {
            assert_eq!(
                HIGHLIGHT_NAMES[i].replace('.', " "),
                HIGHLIGHT_CLASS_NAMES[i]
            );

            assert_eq!(
                HIGHLIGHT_CLASS_NAMES[i].replace(' ', "."),
                HIGHLIGHT_NAMES[i]
            )
        }
    }
}