Add the cache generator subcommand and docs for custom syntaxes

This commit is contained in:
Michael Howell 2021-09-18 15:15:37 -07:00
parent b1e3e5692d
commit 8266ea9f9c
21 changed files with 2283 additions and 709 deletions

2
.gitignore vendored
View File

@ -13,6 +13,8 @@ test_book/book/
# Ignore Jetbrains specific files. # Ignore Jetbrains specific files.
.idea/ .idea/
src/theme/syntaxes.bin
# Ignore Vim temporary and swap files. # Ignore Vim temporary and swap files.
*.sw? *.sw?
*~ *~

View File

@ -14,6 +14,10 @@ license = "MPL-2.0"
readme = "README.md" readme = "README.md"
repository = "https://github.com/rust-lang/mdBook" repository = "https://github.com/rust-lang/mdBook"
description = "Creates a book from markdown files" description = "Creates a book from markdown files"
build = "build.rs"
[build-dependencies]
syntect = { version = "4.6.0", default-features = false, features = ["regex-onig", "parsing", "html", "dump-load", "yaml-load", "dump-create", "assets"] }
[dependencies] [dependencies]
anyhow = "1.0.28" anyhow = "1.0.28"
@ -58,10 +62,11 @@ pretty_assertions = "1.2.1"
walkdir = "2.0" walkdir = "2.0"
[features] [features]
default = ["watch", "serve", "search"] default = ["watch", "serve", "search", "gen-syntax-cache"]
watch = ["notify", "gitignore"] watch = ["notify", "gitignore"]
serve = ["futures-util", "tokio", "warp"] serve = ["futures-util", "tokio", "warp"]
search = ["elasticlunr-rs", "ammonia"] search = ["elasticlunr-rs", "ammonia"]
gen-syntax-cache = ["syntect/dump-create"]
[[bin]] [[bin]]
doc = false doc = false

18
build.rs Normal file
View File

@ -0,0 +1,18 @@
use std::env;
use std::error::Error;
use syntect::dumps::dump_to_file;
use syntect::parsing::SyntaxSet;
pub fn main() -> Result<(), Box<dyn Error>> {
let src_dir = format!(
"{}/src/theme/syntaxes/",
env::var("CARGO_MANIFEST_DIR").unwrap()
);
let dest = format!("{}/syntaxes.bin", env::var("OUT_DIR").unwrap());
let mut builder = SyntaxSet::load_defaults_newlines().into_builder();
builder.add_from_folder(&src_dir, true)?;
dump_to_file(&builder.build(), dest)?;
Ok(())
}

View File

@ -1,6 +1,6 @@
# Syntax Highlighting # Syntax Highlighting
mdBook uses [Highlight.js](https://highlightjs.org) with a custom theme mdBook uses [syntect](https://docs.rs/syntect/4.6.0/syntect/) with a custom theme
for syntax highlighting. for syntax highlighting.
Automatic language detection has been turned off, so you will probably want to Automatic language detection has been turned off, so you will probably want to
@ -17,65 +17,103 @@ fn main() {
## Supported languages ## Supported languages
These languages are supported by default, but you can add more by supplying These languages are supported by default, but you can add more by supplying
your own `highlight.js` file: your own `.sublime-syntax` file:
- apache <!-- this list is generated by running `cargo run -- gen-syntax-cache --syntaxes-only` -->
- armasm <!-- which outputs a list of names -->
- bash
- c Name | Extensions
- coffeescript -----|-----------
- cpp Plain Text | txt
- csharp ASP | asa
- css HTML (ASP) | asp
- d ActionScript | as
- diff AppleScript | applescript script editor
- go Batch File | bat cmd
- handlebars NAnt Build File | build
- haskell C# | cs csx
- http C++ | cpp cc cp cxx c++ C h hh hpp hxx h++ inl ipp
- ini C | c h
- java CSS | css css.erb css.liquid
- javascript Clojure | clj
- json D | d di
- julia Diff | diff patch
- kotlin Erlang | erl hrl Emakefile emakefile
- less HTML (Erlang) | yaws
- lua Go | go
- makefile Graphviz (DOT) | dot DOT gv
- markdown Groovy | groovy gvy gradle
- nginx HTML | html htm shtml xhtml inc tmpl tpl
- objectivec Haskell | hs
- perl Literate Haskell | lhs
- php Java Server Page (JSP) | jsp
- plaintext Java | java bsh
- properties JavaDoc |
- python Java Properties | properties
- r JSON | json sublime-settings sublime-menu sublime-keymap sublime-mousemap sublime-theme sublime-build sublime-project sublime-completions sublime-commands sublime-macro sublime-color-scheme
- ruby JavaScript | js htc
- rust Regular Expressions (Javascript) |
- scala BibTeX | bib
- scss LaTeX Log |
- shell LaTeX | tex ltx
- sql TeX | sty cls
- swift Lisp | lisp cl clisp l mud el scm ss lsp fasl
- typescript Lua | lua
- x86asm Make Output |
- xml Makefile | make GNUmakefile makefile Makefile OCamlMakefile mak mk
- yaml Markdown | md mdown markdown markdn
MultiMarkdown |
MATLAB | matlab
OCaml | ml mli
OCamllex | mll
OCamlyacc | mly
camlp4 |
Objective-C++ | mm M h
Objective-C | m h
PHP Source |
PHP | php php3 php4 php5 php7 phps phpt phtml
Pascal | pas p dpr
Perl | pl pm pod t PL
Python | py py3 pyw pyi pyx pyx.in pxd pxd.in pxi pxi.in rpy cpy SConstruct Sconstruct sconstruct SConscript gyp gypi Snakefile script
Regular Expressions (Python) |
R Console |
R | R r s S Rprofile
Rd (R Documentation) | rd
HTML (Rails) | rails rhtml erb html.erb
JavaScript (Rails) | js.erb
Ruby Haml | haml sass
Ruby on Rails | rxml builder
SQL (Rails) | erbsql sql.erb
Regular Expression | re
reStructuredText | rst rest
Ruby | rb Appfile Appraisals Berksfile Brewfile capfile cgi Cheffile config.ru Deliverfile Fastfile fcgi Gemfile gemspec Guardfile irbrc jbuilder podspec prawn rabl rake Rakefile Rantfile rbx rjs ruby.rail Scanfile simplecov Snapfile thor Thorfile Vagrantfile
Cargo Build Results |
Rust | rs
SQL | sql ddl dml
Scala | scala sbt
Bourne Again Shell (bash) | sh bash zsh fish .bash_aliases .bash_completions .bash_functions .bash_login .bash_logout .bash_profile .bash_variables .bashrc .profile .textmate_init
Shell-Unix-Generic |
commands-builtin-shell-bash |
HTML (Tcl) | adp
Tcl | tcl
Textile | textile
XML | xml xsd xslt tld dtml rss opml svg
YAML | yaml yml sublime-syntax
Handlebars | handlebars handlebars.html hbr hbrs hbs hdbs hjs mu mustache rac stache template tmpl]
## Custom theme ## Custom theme
Like the rest of the theme, the files used for syntax highlighting can be
overridden with your own.
- ***highlight.js*** normally you shouldn't have to overwrite this file, unless Use the `gen-syntax-cache` command to compile sublime text syntax definitions and textmate theme files for mdbook.
you want to use a more recent version.
- ***highlight.css*** theme used by highlight.js for syntax highlighting.
If you want to use another theme for `highlight.js` download it from their mdbook gen-syntax-cache --dest-dir=./theme ./syntax
website, or make it yourself, rename it to `highlight.css` and put it in
the `theme` folder of your book.
Now your theme will be used instead of the default theme. The `gen-syntax-cache` will process every `tmTheme` file, and generate a similarly-named file in `[dest-dir]/css/syntax`,
and will also process every `sublime-syntax` file and add it to the `syntaxes.bin` cache. When building your book,
mdBook will look in the ./theme directory for the `syntaxes.bin` cache and use it, and will also copy across the generated
CSS files.
mdBook includes, by default, the above standard syntax definitions when generating the `syntaxes.bin` cache. If you want to
override all of the syntax definitions, pass the `--no-default-syntaxes` option.
## Hiding code lines ## Hiding code lines

View File

@ -0,0 +1,97 @@
use clap::{App, ArgMatches, SubCommand};
use mdbook::errors::Result;
use std::env;
use std::io::Cursor;
use syntect::dumps::dump_to_file;
use syntect::highlighting::ThemeSet;
use syntect::html::css_for_theme_with_class_style;
use syntect::html::ClassStyle;
use syntect::parsing::{SyntaxSet, SyntaxSetBuilder};
// Create clap subcommand arguments
pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {
SubCommand::with_name("gen-syntax-cache")
.about("Generate syntaxes.bin and css/syntax")
.arg_from_usage(
"-d, --dest-dir=[dir] 'Output directory for the syntax cache{n}\
Relative paths are interpreted relative to the current working directory.{n}\
If omitted, mdBook uses `.`.
This command outputs files [dir]/syntaxes.bin and [dir]/css/syntax/*.css'",
)
.arg_from_usage("--syntaxes-only 'Only generate syntaxes.bin, not css/syntax/*.css.'")
.arg_from_usage(
"--no-default-syntaxes 'Don't include Sublime Text's default open source syntaxes{n}\
If included, only syntaxes from [dir] are used.'",
)
.arg_from_usage("--themes-only 'Only generate themes, not syntaxes.bin.'")
.arg_from_usage(
"--no-default-themes 'Don't include mdbook's default light, dark, and ayu themes{n}\
If included, only themes from [dir] are used.'",
)
.arg_from_usage(
"[dir] 'Root directory for the syntax sources{n}\
(Defaults to the Current Directory when omitted)'",
)
}
// Generate Syntax Cache command implementation
pub fn execute(args: &ArgMatches) -> Result<()> {
let src_dir = env::current_dir()
.unwrap()
.join(&format!("{}/", args.value_of("dir").unwrap_or(".")));
let dest_dir = env::current_dir()
.unwrap()
.join(&format!("{}/", args.value_of("dest-dir").unwrap_or(".")));
if !args.is_present("themes-only") {
let mut builder = if args.is_present("no-default-syntaxes") {
SyntaxSetBuilder::new()
} else {
syntect::dumps::from_binary::<SyntaxSet>(mdbook::theme::SYNTAXES_BIN).into_builder()
};
builder.add_from_folder(&src_dir, true)?;
let set = builder.build();
for syntax in set.syntaxes() {
info!(
"supports syntax: {} [{}]",
syntax.name,
syntax.file_extensions.join(" ")
);
}
dump_to_file(&set, dest_dir.join("syntaxes.bin"))?;
}
if !args.is_present("syntaxes-only") {
let mut builder = ThemeSet::load_from_folder(&src_dir)?;
if !args.is_present("no-default-themes") {
if !builder.themes.contains_key("light") {
let light = ThemeSet::load_from_reader(&mut Cursor::new(
mdbook::theme::SYNTAX_THEME_LIGHT,
))?;
builder.themes.insert(String::from("light"), light);
}
if !builder.themes.contains_key("dark") {
let dark =
ThemeSet::load_from_reader(&mut Cursor::new(mdbook::theme::SYNTAX_THEME_DARK))?;
builder.themes.insert(String::from("dark"), dark);
}
if !builder.themes.contains_key("ayu") {
let ayu =
ThemeSet::load_from_reader(&mut Cursor::new(mdbook::theme::SYNTAX_THEME_AYU))?;
builder.themes.insert(String::from("ayu"), ayu);
}
}
for (name, theme) in builder.themes.iter() {
info!("supports theme: {}", name);
std::fs::write(
dest_dir.join(format!("css/syntax/{}.css", name)),
css_for_theme_with_class_style(
theme,
ClassStyle::SpacedPrefixed { prefix: "syn-" },
),
)?;
}
}
Ok(())
}

View File

@ -2,6 +2,8 @@
pub mod build; pub mod build;
pub mod clean; pub mod clean;
#[cfg(feature = "gen-syntax-cache")]
pub mod gen_syntax_cache;
pub mod init; pub mod init;
#[cfg(feature = "serve")] #[cfg(feature = "serve")]
pub mod serve; pub mod serve;

View File

@ -35,6 +35,9 @@ fn main() {
Some(("serve", sub_matches)) => cmd::serve::execute(sub_matches), Some(("serve", sub_matches)) => cmd::serve::execute(sub_matches),
Some(("test", sub_matches)) => cmd::test::execute(sub_matches), Some(("test", sub_matches)) => cmd::test::execute(sub_matches),
Some(("completions", sub_matches)) => (|| { Some(("completions", sub_matches)) => (|| {
#[cfg(feature = "gen_syntax_cache")]
("gen-syntax-cache", Some(sub_matches)) => cmd::gen_syntax_cache::execute(sub_matches),
("completions", Some(sub_matches)) => (|| {
let shell: Shell = sub_matches let shell: Shell = sub_matches
.value_of("shell") .value_of("shell")
.ok_or_else(|| anyhow!("Shell name missing."))? .ok_or_else(|| anyhow!("Shell name missing."))?
@ -93,6 +96,8 @@ fn create_clap_app() -> App<'static> {
let app = app.subcommand(cmd::watch::make_subcommand()); let app = app.subcommand(cmd::watch::make_subcommand());
#[cfg(feature = "serve")] #[cfg(feature = "serve")]
let app = app.subcommand(cmd::serve::make_subcommand()); let app = app.subcommand(cmd::serve::make_subcommand());
#[cfg(feature = "gen-syntax-cache")]
let app = app.subcommand(cmd::gen_syntax_cache::make_subcommand());
app app
} }

View File

@ -1,412 +1,151 @@
/* /*
* theme "ayu" generated by syntect * theme "Base16 Tomorrow Night" generated by syntect
* based off of Ayu by Dempfi
* https://github.com/dempfi/ayu/blob/master/ayu-dark.sublime-color-scheme
*/ */
.syn-code { .syn-code {
color: #b3b1ad; color: #c5c8c6;
background-color: #0a0e14; background-color: #1d1f21;
} }
.syn-comment { .syn-variable.syn-parameter.syn-function {
color: #626a73; color: #c5c8c6;
font-style: italic;
} }
.syn-string { .syn-comment, .syn-punctuation.syn-definition.syn-comment {
color: #c2d94c; color: #969896;
} }
.syn-constant.syn-other.syn-symbol { .syn-punctuation.syn-definition.syn-string, .syn-punctuation.syn-definition.syn-variable, .syn-punctuation.syn-definition.syn-string, .syn-punctuation.syn-definition.syn-parameters, .syn-punctuation.syn-definition.syn-string, .syn-punctuation.syn-definition.syn-array {
color: #c2d94c; color: #c5c8c6;
} }
.syn-string.syn-regexp { .syn-none {
color: #95e6cb; color: #c5c8c6;
}
.syn-constant.syn-character {
color: #95e6cb;
}
.syn-constant.syn-other {
color: #95e6cb;
}
.syn-constant.syn-numeric {
color: #e6b450;
}
.syn-constant.syn-language {
color: #e6b450;
}
.syn-meta.syn-constant {
color: #ffee99;
}
.syn-entity.syn-name.syn-constant {
color: #ffee99;
}
.syn-variable {
color: #b3b1ad;
}
.syn-variable.syn-member {
color: #f07178;
}
.syn-variable.syn-language {
color: #39bae6;
font-style: italic;
}
.syn-storage {
color: #ff8f40;
}
.syn-storage.syn-type.syn-keyword {
color: #ff8f40;
}
.syn-keyword {
color: #ff8f40;
}
.syn-source.syn-java {
color: #ff8f40;
}
.syn-meta.syn-class.syn-java {
color: #ff8f40;
}
.syn-meta.syn-class.syn-identifier.syn-java {
color: #ff8f40;
}
.syn-storage.syn-type.syn-java {
color: #ff8f40;
} }
.syn-keyword.syn-operator { .syn-keyword.syn-operator {
color: #f29668; color: #c5c8c6;
} }
.syn-punctuation.syn-separator { .syn-keyword {
color: #b3b1ad; color: #b294bb;
} }
.syn-punctuation.syn-terminator { .syn-variable {
color: #b3b1ad; color: #cc6666;
} }
.syn-punctuation.syn-section { .syn-entity.syn-name.syn-function, .syn-meta.syn-require, .syn-support.syn-function.syn-any-method {
color: #b3b1ad; color: #81a2be;
} }
.syn-punctuation.syn-accessor { .syn-entity.syn-name.syn-label {
color: #f29668; color: #a3685a;
} }
.syn-source.syn-java { .syn-support.syn-class, .syn-entity.syn-name.syn-class, .syn-entity.syn-name.syn-type.syn-class {
color: #59c2ff; color: #f0c674;
} }
.syn-storage.syn-type { .syn-meta.syn-class {
color: #59c2ff; color: #ffffff;
} }
.syn-source.syn-haskell { .syn-keyword.syn-other.syn-special-method {
color: #59c2ff; color: #81a2be;
} }
.syn-storage.syn-type { .syn-storage {
color: #59c2ff; color: #b294bb;
}
.syn-source.syn-c {
color: #59c2ff;
}
.syn-storage.syn-type {
color: #59c2ff;
}
.syn-entity.syn-other.syn-inherited-class {
color: #39bae6;
}
.syn-storage.syn-type.syn-function {
color: #ff8f40;
}
.syn-source.syn-java {
color: #39bae6;
}
.syn-storage.syn-type.syn-primitive {
color: #39bae6;
}
.syn-entity.syn-name.syn-function {
color: #ffb454;
}
.syn-variable.syn-parameter {
color: #ffee99;
}
.syn-meta.syn-parameter {
color: #ffee99;
}
.syn-variable.syn-function {
color: #ffb454;
}
.syn-variable.syn-annotation {
color: #ffb454;
}
.syn-meta.syn-function-call.syn-generic {
color: #ffb454;
}
.syn-support.syn-function.syn-go {
color: #ffb454;
} }
.syn-support.syn-function { .syn-support.syn-function {
color: #f07178; color: #8abeb7;
} }
.syn-support.syn-macro { .syn-string, .syn-constant.syn-other.syn-symbol, .syn-entity.syn-other.syn-inherited-class {
color: #f07178; color: #b5bd68;
} }
.syn-entity.syn-name.syn-import { .syn-constant.syn-numeric {
color: #c2d94c; color: #de935f;
} }
.syn-entity.syn-name.syn-package { .syn-none {
color: #c2d94c; color: #de935f;
} }
.syn-entity.syn-name { .syn-none {
color: #59c2ff; color: #de935f;
} }
.syn-source.syn-js { .syn-constant {
color: #59c2ff; color: #de935f;
}
.syn-meta.syn-function-call.syn-constructor {
color: #59c2ff;
}
.syn-variable.syn-type {
color: #59c2ff;
} }
.syn-entity.syn-name.syn-tag { .syn-entity.syn-name.syn-tag {
color: #39bae6; color: #cc6666;
}
.syn-meta.syn-tag.syn-sgml {
color: #39bae6;
}
.syn-punctuation.syn-definition.syn-tag.syn-end {
color: #39bae6;
}
.syn-punctuation.syn-definition.syn-tag.syn-begin {
color: #39bae6;
}
.syn-punctuation.syn-definition.syn-tag {
color: #39bae6;
} }
.syn-entity.syn-other.syn-attribute-name { .syn-entity.syn-other.syn-attribute-name {
color: #ffb454; color: #de935f;
} }
.syn-support.syn-constant { .syn-entity.syn-other.syn-attribute-name.syn-id, .syn-punctuation.syn-definition.syn-entity {
color: #f29668; color: #81a2be;
}
.syn-meta.syn-selector {
color: #b294bb;
}
.syn-none {
color: #de935f;
}
.syn-markup.syn-heading .syn-punctuation.syn-definition.syn-heading, .syn-entity.syn-name.syn-section {
color: #81a2be;
}
.syn-keyword.syn-other.syn-unit {
color: #de935f;
}
.syn-markup.syn-bold, .syn-punctuation.syn-definition.syn-bold {
color: #f0c674;
font-weight: bold;
}
.syn-markup.syn-italic, .syn-punctuation.syn-definition.syn-italic {
color: #b294bb;
font-style: italic; font-style: italic;
} }
.syn-support.syn-type {
color: #39bae6;
}
.syn-support.syn-class {
color: #39bae6;
}
.syn-source.syn-go {
color: #39bae6;
}
.syn-storage.syn-type {
color: #39bae6;
}
.syn-meta.syn-decorator {
color: #e6b673;
}
.syn-variable.syn-other {
color: #e6b673;
}
.syn-meta.syn-decorator {
color: #e6b673;
}
.syn-punctuation.syn-decorator {
color: #e6b673;
}
.syn-storage.syn-type.syn-annotation {
color: #e6b673;
}
.syn-variable.syn-annotation {
color: #e6b673;
}
.syn-punctuation.syn-definition.syn-annotation {
color: #e6b673;
}
.syn-invalid {
color: #ff3333;
}
.syn-meta.syn-diff {
color: #c594c5;
}
.syn-meta.syn-diff.syn-header {
color: #c594c5;
}
.syn-source.syn-ruby {
color: #ffb454;
}
.syn-variable.syn-other.syn-readwrite {
color: #ffb454;
}
.syn-source.syn-css {
color: #59c2ff;
}
.syn-entity.syn-name.syn-tag {
color: #59c2ff;
}
.syn-source.syn-sass {
color: #59c2ff;
}
.syn-entity.syn-name.syn-tag {
color: #59c2ff;
}
.syn-source.syn-scss {
color: #59c2ff;
}
.syn-entity.syn-name.syn-tag {
color: #59c2ff;
}
.syn-source.syn-less {
color: #59c2ff;
}
.syn-entity.syn-name.syn-tag {
color: #59c2ff;
}
.syn-source.syn-stylus {
color: #59c2ff;
}
.syn-entity.syn-name.syn-tag {
color: #59c2ff;
}
.syn-source.syn-css {
color: #626a73;
}
.syn-support.syn-type {
color: #626a73;
}
.syn-source.syn-sass {
color: #626a73;
}
.syn-support.syn-type {
color: #626a73;
}
.syn-source.syn-scss {
color: #626a73;
}
.syn-support.syn-type {
color: #626a73;
}
.syn-source.syn-less {
color: #626a73;
}
.syn-support.syn-type {
color: #626a73;
}
.syn-source.syn-stylus {
color: #626a73;
}
.syn-support.syn-type {
color: #626a73;
}
.syn-support.syn-type.syn-property-name {
color: #39bae6;
}
.syn-constant.syn-numeric.syn-line-number.syn-find-in-files {
color: #626a73;
}
.syn-constant.syn-numeric.syn-line-number.syn-match {
color: #ff8f40;
}
.syn-entity.syn-name.syn-filename.syn-find-in-files {
color: #c2d94c;
}
.syn-message.syn-error {
color: #ff3333;
}
.syn-markup.syn-heading {
color: #c2d94c;
font-weight: bold;
}
.syn-markup.syn-heading {
color: #c2d94c;
font-weight: bold;
}
.syn-entity.syn-name {
color: #c2d94c;
font-weight: bold;
}
.syn-markup.syn-underline.syn-link {
color: #39bae6;
}
.syn-string.syn-other.syn-link {
color: #39bae6;
}
.syn-markup.syn-italic {
color: #f07178;
font-style: italic;
}
.syn-markup.syn-bold {
color: #f07178;
font-weight: bold;
}
.syn-markup.syn-italic {
font-weight: bold;
font-style: italic;
}
.syn-markup.syn-bold {
font-weight: bold;
font-style: italic;
}
.syn-markup.syn-bold {
font-weight: bold;
font-style: italic;
}
.syn-markup.syn-italic {
font-weight: bold;
font-style: italic;
}
.syn-markup.syn-raw {
background: #191f26;
}
.syn-markup.syn-raw.syn-inline { .syn-markup.syn-raw.syn-inline {
background: #191f26; color: #b5bd68;
} }
.syn-meta.syn-separator { .syn-string.syn-other.syn-link, .syn-punctuation.syn-definition.syn-string.syn-end.syn-markdown, .syn-punctuation.syn-definition.syn-string.syn-begin.syn-markdown {
color: #626a73; color: #cc6666;
background-color: #b3b1ad;
font-weight: bold;
} }
.syn-markup.syn-quote { .syn-meta.syn-link {
color: #95e6cb; color: #de935f;
font-style: italic;
} }
.syn-markup.syn-list { .syn-markup.syn-list {
color: #ffb454; color: #cc6666;
} }
.syn-punctuation.syn-definition.syn-list.syn-begin { .syn-markup.syn-quote {
color: #ffb454; color: #de935f;
}
.syn-meta.syn-separator {
color: #c5c8c6;
background-color: #373b41;
} }
.syn-markup.syn-inserted { .syn-markup.syn-inserted {
color: #91b362; color: #b5bd68;
}
.syn-markup.syn-changed {
color: #6994bf;
} }
.syn-markup.syn-deleted { .syn-markup.syn-deleted {
color: #d96c75; color: #cc6666;
} }
.syn-markup.syn-strike { .syn-markup.syn-changed {
color: #e6b673; color: #b294bb;
} }
.syn-markup.syn-table { .syn-constant.syn-other.syn-color {
color: #39bae6; color: #8abeb7;
background-color: #b3b1ad;
} }
.syn-text.syn-html.syn-markdown { .syn-string.syn-regexp {
color: #f29668; color: #8abeb7;
} }
.syn-markup.syn-inline.syn-raw { .syn-constant.syn-character.syn-escape {
color: #f29668; color: #8abeb7;
} }
.syn-text.syn-html.syn-markdown { .syn-punctuation.syn-section.syn-embedded, .syn-variable.syn-interpolation {
color: #626a73; color: #b294bb;
background-color: #626a73;
} }
.syn-meta.syn-dummy.syn-line-break { .syn-invalid.syn-illegal {
color: #626a73; color: #ffffff;
background-color: #626a73; background-color: #cc6666;
} }
.syn-punctuation.syn-definition.syn-markdown { .syn-invalid.syn-broken {
color: #626a73; color: #1d1f21;
background-color: #b3b1ad; background-color: #de935f;
} }
.scode { .syn-invalid.syn-deprecated {
display: block; color: #ffffff;
overflow-x: auto; background-color: #a3685a;
background: #191f26; }
color: #e6e1cf; .syn-invalid.syn-unimplemented {
padding: 0.5em; color: #ffffff;
background-color: #969896;
} }

View File

@ -1,222 +1,151 @@
* theme "Base16 Tomorrow Night" generated by syntect /*
* based off of Base16 Tomorrow Night by Chris Kempson * theme "Base16 Tomorrow Night" generated by syntect
* https://github.com/chriskempson/base16-textmate/blob/master/Themes/base16-tomorrow-night.tmTheme */
*/
.syn-code { .syn-code {
color: #c5c8c6; color: #c5c8c6;
background-color: #1d1f21; background-color: #1d1f21;
} }
.syn-variable.syn-parameter.syn-function { .syn-variable.syn-parameter.syn-function {
color: #c5c8c6; color: #c5c8c6;
} }
.syn-comment { .syn-comment, .syn-punctuation.syn-definition.syn-comment {
color: #969896; color: #969896;
} }
.syn-punctuation.syn-definition.syn-comment { .syn-punctuation.syn-definition.syn-string, .syn-punctuation.syn-definition.syn-variable, .syn-punctuation.syn-definition.syn-string, .syn-punctuation.syn-definition.syn-parameters, .syn-punctuation.syn-definition.syn-string, .syn-punctuation.syn-definition.syn-array {
color: #969896; color: #c5c8c6;
}
.syn-punctuation.syn-definition.syn-string {
color: #c5c8c6;
}
.syn-punctuation.syn-definition.syn-variable {
color: #c5c8c6;
}
.syn-punctuation.syn-definition.syn-string {
color: #c5c8c6;
}
.syn-punctuation.syn-definition.syn-parameters {
color: #c5c8c6;
}
.syn-punctuation.syn-definition.syn-string {
color: #c5c8c6;
}
.syn-punctuation.syn-definition.syn-array {
color: #c5c8c6;
} }
.syn-none { .syn-none {
color: #c5c8c6; color: #c5c8c6;
} }
.syn-keyword.syn-operator { .syn-keyword.syn-operator {
color: #c5c8c6; color: #c5c8c6;
} }
.syn-keyword { .syn-keyword {
color: #b294bb; color: #b294bb;
} }
.syn-variable { .syn-variable {
color: #cc6666; color: #cc6666;
} }
.syn-entity.syn-name.syn-function { .syn-entity.syn-name.syn-function, .syn-meta.syn-require, .syn-support.syn-function.syn-any-method {
color: #81a2be; color: #81a2be;
}
.syn-meta.syn-require {
color: #81a2be;
}
.syn-support.syn-function.syn-any-method {
color: #81a2be;
} }
.syn-entity.syn-name.syn-label { .syn-entity.syn-name.syn-label {
color: #a3685a; color: #a3685a;
} }
.syn-support.syn-class { .syn-support.syn-class, .syn-entity.syn-name.syn-class, .syn-entity.syn-name.syn-type.syn-class {
color: #f0c674; color: #f0c674;
}
.syn-entity.syn-name.syn-class {
color: #f0c674;
}
.syn-entity.syn-name.syn-type.syn-class {
color: #f0c674;
} }
.syn-meta.syn-class { .syn-meta.syn-class {
color: #ffffff; color: #ffffff;
} }
.syn-keyword.syn-other.syn-special-method { .syn-keyword.syn-other.syn-special-method {
color: #81a2be; color: #81a2be;
} }
.syn-storage { .syn-storage {
color: #b294bb; color: #b294bb;
} }
.syn-support.syn-function { .syn-support.syn-function {
color: #8abeb7; color: #8abeb7;
} }
.syn-string { .syn-string, .syn-constant.syn-other.syn-symbol, .syn-entity.syn-other.syn-inherited-class {
color: #b5bd68; color: #b5bd68;
}
.syn-constant.syn-other.syn-symbol {
color: #b5bd68;
}
.syn-entity.syn-other.syn-inherited-class {
color: #b5bd68;
} }
.syn-constant.syn-numeric { .syn-constant.syn-numeric {
color: #de935f; color: #de935f;
} }
.syn-none { .syn-none {
color: #de935f; color: #de935f;
} }
.syn-none { .syn-none {
color: #de935f; color: #de935f;
} }
.syn-constant { .syn-constant {
color: #de935f; color: #de935f;
} }
.syn-entity.syn-name.syn-tag { .syn-entity.syn-name.syn-tag {
color: #cc6666; color: #cc6666;
} }
.syn-entity.syn-other.syn-attribute-name { .syn-entity.syn-other.syn-attribute-name {
color: #de935f; color: #de935f;
} }
.syn-entity.syn-other.syn-attribute-name.syn-id { .syn-entity.syn-other.syn-attribute-name.syn-id, .syn-punctuation.syn-definition.syn-entity {
color: #81a2be; color: #81a2be;
}
.syn-punctuation.syn-definition.syn-entity {
color: #81a2be;
} }
.syn-meta.syn-selector { .syn-meta.syn-selector {
color: #b294bb; color: #b294bb;
} }
.syn-none { .syn-none {
color: #de935f; color: #de935f;
} }
.syn-markup.syn-heading { .syn-markup.syn-heading .syn-punctuation.syn-definition.syn-heading, .syn-entity.syn-name.syn-section {
color: #81a2be; color: #81a2be;
}
.syn-punctuation.syn-definition.syn-heading {
color: #81a2be;
}
.syn-entity.syn-name.syn-section {
color: #81a2be;
} }
.syn-keyword.syn-other.syn-unit { .syn-keyword.syn-other.syn-unit {
color: #de935f; color: #de935f;
} }
.syn-markup.syn-bold { .syn-markup.syn-bold, .syn-punctuation.syn-definition.syn-bold {
color: #f0c674; color: #f0c674;
font-weight: bold; font-weight: bold;
} }
.syn-punctuation.syn-definition.syn-bold { .syn-markup.syn-italic, .syn-punctuation.syn-definition.syn-italic {
color: #f0c674; color: #b294bb;
font-weight: bold;
}
.syn-markup.syn-italic {
color: #b294bb;
font-style: italic;
}
.syn-punctuation.syn-definition.syn-italic {
color: #b294bb;
font-style: italic; font-style: italic;
} }
.syn-markup.syn-raw.syn-inline { .syn-markup.syn-raw.syn-inline {
color: #b5bd68; color: #b5bd68;
} }
.syn-string.syn-other.syn-link { .syn-string.syn-other.syn-link, .syn-punctuation.syn-definition.syn-string.syn-end.syn-markdown, .syn-punctuation.syn-definition.syn-string.syn-begin.syn-markdown {
color: #cc6666; color: #cc6666;
}
.syn-punctuation.syn-definition.syn-string.syn-end.syn-markdown {
color: #cc6666;
}
.syn-punctuation.syn-definition.syn-string.syn-begin.syn-markdown {
color: #cc6666;
} }
.syn-meta.syn-link { .syn-meta.syn-link {
color: #de935f; color: #de935f;
} }
.syn-markup.syn-list { .syn-markup.syn-list {
color: #cc6666; color: #cc6666;
} }
.syn-markup.syn-quote { .syn-markup.syn-quote {
color: #de935f; color: #de935f;
} }
.syn-meta.syn-separator { .syn-meta.syn-separator {
color: #c5c8c6; color: #c5c8c6;
background-color: #373b41; background-color: #373b41;
} }
.syn-markup.syn-inserted { .syn-markup.syn-inserted {
color: #b5bd68; color: #b5bd68;
} }
.syn-markup.syn-deleted { .syn-markup.syn-deleted {
color: #cc6666; color: #cc6666;
} }
.syn-markup.syn-changed { .syn-markup.syn-changed {
color: #b294bb; color: #b294bb;
} }
.syn-constant.syn-other.syn-color { .syn-constant.syn-other.syn-color {
color: #8abeb7; color: #8abeb7;
} }
.syn-string.syn-regexp { .syn-string.syn-regexp {
color: #8abeb7; color: #8abeb7;
} }
.syn-constant.syn-character.syn-escape { .syn-constant.syn-character.syn-escape {
color: #8abeb7; color: #8abeb7;
} }
.syn-punctuation.syn-section.syn-embedded { .syn-punctuation.syn-section.syn-embedded, .syn-variable.syn-interpolation {
color: #b294bb; color: #b294bb;
}
.syn-variable.syn-interpolation {
color: #b294bb;
} }
.syn-invalid.syn-illegal { .syn-invalid.syn-illegal {
color: #ffffff; color: #ffffff;
background-color: #cc6666; background-color: #cc6666;
} }
.syn-invalid.syn-broken { .syn-invalid.syn-broken {
color: #1d1f21; color: #1d1f21;
background-color: #de935f; background-color: #de935f;
} }
.syn-invalid.syn-deprecated { .syn-invalid.syn-deprecated {
color: #ffffff; color: #ffffff;
background-color: #a3685a; background-color: #a3685a;
} }
.syn-invalid.syn-unimplemented { .syn-invalid.syn-unimplemented {
color: #ffffff; color: #ffffff;
background-color: #969896; background-color: #969896;
}
.scode {
display: block;
overflow-x: auto;
background: #1d1f21;
color: #c5c8c6;
padding: 0.5em;
-webkit-text-size-adjust: none;
} }

View File

@ -1,215 +1,148 @@
/* /*
* theme "Base16 Atelier Dune Light" generated by syntect * theme "Base16 Atelier Dune Light" generated by syntect
* Based off of the "Base16 Atelier Dune Light" theme by Bram de Haan */
* (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)
* Original Base16 color scheme by Chris Kempson
* (https://github.com/chriskempson/base16)
*/
.syn-code { .syn-code {
color: #6e6b5e; color: #6e6b5e;
background-color: #fefbec; background-color: #fefbec;
} }
.syn-variable.syn-parameter.syn-function { .syn-variable.syn-parameter.syn-function {
color: #6e6b5e; color: #6e6b5e;
} }
.syn-comment { .syn-comment, .syn-punctuation.syn-definition.syn-comment {
color: #999580; color: #999580;
} }
.syn-punctuation.syn-definition.syn-comment { .syn-punctuation.syn-definition.syn-string, .syn-punctuation.syn-definition.syn-variable, .syn-punctuation.syn-definition.syn-string, .syn-punctuation.syn-definition.syn-parameters, .syn-punctuation.syn-definition.syn-string, .syn-punctuation.syn-definition.syn-array {
color: #999580; color: #6e6b5e;
}
.syn-punctuation.syn-definition.syn-string {
color: #6e6b5e;
}
.syn-punctuation.syn-definition.syn-variable {
color: #6e6b5e;
}
.syn-punctuation.syn-definition.syn-string {
color: #6e6b5e;
}
.syn-punctuation.syn-definition.syn-parameters {
color: #6e6b5e;
}
.syn-punctuation.syn-definition.syn-string {
color: #6e6b5e;
}
.syn-punctuation.syn-definition.syn-array {
color: #6e6b5e;
} }
.syn-none { .syn-none {
color: #6e6b5e; color: #6e6b5e;
} }
.syn-keyword.syn-operator { .syn-keyword.syn-operator {
color: #6e6b5e; color: #6e6b5e;
} }
.syn-keyword { .syn-keyword {
color: #b854d4; color: #b854d4;
} }
.syn-variable { .syn-variable {
color: #d73737; color: #d73737;
} }
.syn-entity.syn-name.syn-function { .syn-entity.syn-name.syn-function, .syn-meta.syn-require, .syn-support.syn-function.syn-any-method {
color: #6684e1; color: #6684e1;
} }
.syn-meta.syn-require { .syn-support.syn-class, .syn-entity.syn-name.syn-class, .syn-entity.syn-name.syn-type.syn-class {
color: #6684e1; color: #b65611;
}
.syn-support.syn-function.syn-any-method {
color: #6684e1;
}
.syn-support.syn-class {
color: #b65611;
}
.syn-entity.syn-name.syn-class {
color: #b65611;
}
.syn-entity.syn-name.syn-type.syn-class {
color: #b65611;
} }
.syn-meta.syn-class { .syn-meta.syn-class {
color: #292824; color: #292824;
} }
.syn-keyword.syn-other.syn-special-method { .syn-keyword.syn-other.syn-special-method {
color: #6684e1; color: #6684e1;
} }
.syn-storage { .syn-storage {
color: #b854d4; color: #b854d4;
} }
.syn-support.syn-function { .syn-support.syn-function {
color: #1fad83; color: #1fad83;
} }
.syn-string { .syn-string, .syn-constant.syn-other.syn-symbol, .syn-entity.syn-other.syn-inherited-class {
color: #60ac39; color: #60ac39;
}
.syn-constant.syn-other.syn-symbol {
color: #60ac39;
}
.syn-entity.syn-other.syn-inherited-class {
color: #60ac39;
} }
.syn-constant.syn-numeric { .syn-constant.syn-numeric {
color: #b65611; color: #b65611;
} }
.syn-none { .syn-none {
color: #b65611; color: #b65611;
} }
.syn-none { .syn-none {
color: #b65611; color: #b65611;
} }
.syn-constant { .syn-constant {
color: #b65611; color: #b65611;
} }
.syn-entity.syn-name.syn-tag { .syn-entity.syn-name.syn-tag {
color: #d73737; color: #d73737;
} }
.syn-entity.syn-other.syn-attribute-name { .syn-entity.syn-other.syn-attribute-name {
color: #b65611; color: #b65611;
} }
.syn-entity.syn-other.syn-attribute-name.syn-id { .syn-entity.syn-other.syn-attribute-name.syn-id, .syn-punctuation.syn-definition.syn-entity {
color: #6684e1; color: #6684e1;
}
.syn-punctuation.syn-definition.syn-entity {
color: #6684e1;
} }
.syn-meta.syn-selector { .syn-meta.syn-selector {
color: #b854d4; color: #b854d4;
} }
.syn-none { .syn-none {
color: #b65611; color: #b65611;
} }
.syn-markup.syn-heading { .syn-markup.syn-heading .syn-punctuation.syn-definition.syn-heading, .syn-entity.syn-name.syn-section {
color: #6684e1; color: #6684e1;
}
.syn-punctuation.syn-definition.syn-heading {
color: #6684e1;
}
.syn-entity.syn-name.syn-section {
color: #6684e1;
} }
.syn-keyword.syn-other.syn-unit { .syn-keyword.syn-other.syn-unit {
color: #b65611; color: #b65611;
} }
.syn-markup.syn-bold { .syn-markup.syn-bold, .syn-punctuation.syn-definition.syn-bold {
color: #b65611; color: #b65611;
font-weight: bold; font-weight: bold;
} }
.syn-punctuation.syn-definition.syn-bold { .syn-markup.syn-italic, .syn-punctuation.syn-definition.syn-italic {
color: #b65611; color: #b854d4;
font-weight: bold;
}
.syn-markup.syn-italic {
color: #b854d4;
font-style: italic;
}
.syn-punctuation.syn-definition.syn-italic {
color: #b854d4;
font-style: italic; font-style: italic;
} }
.syn-markup.syn-raw.syn-inline { .syn-markup.syn-raw.syn-inline {
color: #60ac39; color: #60ac39;
} }
.syn-string.syn-other.syn-link { .syn-string.syn-other.syn-link {
color: #d73737; color: #d73737;
} }
.syn-meta.syn-link { .syn-meta.syn-link {
color: #b65611; color: #b65611;
} }
.syn-markup.syn-list { .syn-markup.syn-list {
color: #d73737; color: #d73737;
} }
.syn-markup.syn-quote { .syn-markup.syn-quote {
color: #b65611; color: #b65611;
} }
.syn-meta.syn-separator { .syn-meta.syn-separator {
color: #6e6b5e; color: #6e6b5e;
background-color: #e8e4cf; background-color: #e8e4cf;
} }
.syn-markup.syn-inserted { .syn-markup.syn-inserted {
color: #60ac39; color: #60ac39;
} }
.syn-markup.syn-deleted { .syn-markup.syn-deleted {
color: #d73737; color: #d73737;
} }
.syn-markup.syn-changed { .syn-markup.syn-changed {
color: #b854d4; color: #b854d4;
} }
.syn-constant.syn-other.syn-color { .syn-constant.syn-other.syn-color {
color: #1fad83; color: #1fad83;
} }
.syn-string.syn-regexp { .syn-string.syn-regexp {
color: #1fad83; color: #1fad83;
} }
.syn-constant.syn-character.syn-escape { .syn-constant.syn-character.syn-escape {
color: #1fad83; color: #1fad83;
} }
.syn-punctuation.syn-section.syn-embedded { .syn-punctuation.syn-section.syn-embedded, .syn-variable.syn-interpolation {
color: #d43552; color: #d43552;
}
.syn-variable.syn-interpolation {
color: #d43552;
} }
.syn-invalid.syn-illegal { .syn-invalid.syn-illegal {
color: #fefbec; color: #fefbec;
background-color: #d73737; background-color: #d73737;
} }
.syn-invalid.syn-broken { .syn-invalid.syn-broken {
color: #20201d; color: #20201d;
background-color: #b65611; background-color: #b65611;
} }
.syn-invalid.syn-deprecated { .syn-invalid.syn-deprecated {
color: #fefbec; color: #fefbec;
background-color: #d43552; background-color: #d43552;
} }
.syn-invalid.syn-unimplemented { .syn-invalid.syn-unimplemented {
color: #20201d; color: #20201d;
background-color: #a6a28c; background-color: #a6a28c;
}
.scode {
display: block;
overflow-x: auto;
background: #f6f7f6;
color: #000;
padding: 0.5em;
} }

View File

@ -36,7 +36,10 @@ pub static FONT_AWESOME_WOFF: &[u8] = include_bytes!("FontAwesome/fonts/fontawes
pub static FONT_AWESOME_WOFF2: &[u8] = pub static FONT_AWESOME_WOFF2: &[u8] =
include_bytes!("FontAwesome/fonts/fontawesome-webfont.woff2"); include_bytes!("FontAwesome/fonts/fontawesome-webfont.woff2");
pub static FONT_AWESOME_OTF: &[u8] = include_bytes!("FontAwesome/fonts/FontAwesome.otf"); pub static FONT_AWESOME_OTF: &[u8] = include_bytes!("FontAwesome/fonts/FontAwesome.otf");
pub static SYNTAXES_BIN: &[u8] = include_bytes!("syntaxes.bin"); pub static SYNTAXES_BIN: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/syntaxes.bin"));
pub static SYNTAX_THEME_LIGHT: &[u8] = include_bytes!("syntax-themes/light.tmTheme");
pub static SYNTAX_THEME_DARK: &[u8] = include_bytes!("syntax-themes/dark.tmTheme");
pub static SYNTAX_THEME_AYU: &[u8] = include_bytes!("syntax-themes/ayu.tmTheme");
/// The `Theme` struct should be used instead of the static variables because /// The `Theme` struct should be used instead of the static variables because
/// the `new()` method will look if the user has a theme directory in their /// the `new()` method will look if the user has a theme directory in their

View File

@ -0,0 +1,17 @@
dark.tmTheme is from https://github.com/chriskempson/base16-textmate/blob/master/Themes/base16-tomorrow-night.tmTheme
ayu.tmTheme is a tweaked version of the dark theme
light.tmTheme is from https://github.com/atelierbram/syntax-highlighting/blob/master/docs/archive/atelier-schemes/output/textmate/base16-atelierdune.light.tmTheme which is described at https://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune/
This folder is not copied over to the book directory when using `mdbook init`, nor is it indexed at runtime. To modify the themes, modify the tmTheme file, then run:
```shell
$ cargo run -- gen-syntax-cache --themes-only --no-default-themes --dest-dir=..
```
The `--no-default-themes` flag is added because the whole point is to *not* use the ones embedded in the mdbook binary.
Now, you may rebuild the `mdbook` binary and the new themes should be included.
This only needs to be run when the themes in this folder are updated.

View File

@ -0,0 +1,560 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Template: Chris Kempson, Scheme: Chris Kempson (http://chriskempson.com)</string>
<key>name</key>
<string>Base16 Tomorrow Night</string>
<key>semanticClass</key>
<string>theme.base16.tomorrow-night</string>
<key>colorSpaceName</key>
<string>sRGB</string>
<key>gutterSettings</key>
<dict>
<key>background</key>
<string>#282a2e</string>
<key>divider</key>
<string>#282a2e</string>
<key>foreground</key>
<string>#969896</string>
<key>selectionBackground</key>
<string>#373b41</string>
<key>selectionForeground</key>
<string>#b4b7b4</string>
</dict>
<key>settings</key>
<array>
<dict>
<key>settings</key>
<dict>
<key>background</key>
<string>#1d1f21</string>
<key>caret</key>
<string>#c5c8c6</string>
<key>foreground</key>
<string>#c5c8c6</string>
<key>invisibles</key>
<string>#969896</string>
<key>lineHighlight</key>
<string>#96989655</string>
<key>selection</key>
<string>#373b41</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Text</string>
<key>scope</key>
<string>variable.parameter.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c5c8c6</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>comment, punctuation.definition.comment</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#969896</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Punctuation</string>
<key>scope</key>
<string>punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c5c8c6</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Delimiters</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c5c8c6</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Operators</string>
<key>scope</key>
<string>keyword.operator</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c5c8c6</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Keywords</string>
<key>scope</key>
<string>keyword</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Variables</string>
<key>scope</key>
<string>variable</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#cc6666</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Functions</string>
<key>scope</key>
<string>entity.name.function, meta.require, support.function.any-method</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#81a2be</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Labels</string>
<key>scope</key>
<string>entity.name.label</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#a3685a</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Classes</string>
<key>scope</key>
<string>support.class, entity.name.class, entity.name.type.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#f0c674</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Classes</string>
<key>scope</key>
<string>meta.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#ffffff</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Methods</string>
<key>scope</key>
<string>keyword.other.special-method</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#81a2be</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Storage</string>
<key>scope</key>
<string>storage</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Support</string>
<key>scope</key>
<string>support.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#8abeb7</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Strings, Inherited Class</string>
<key>scope</key>
<string>string, constant.other.symbol, entity.other.inherited-class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b5bd68</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Integers</string>
<key>scope</key>
<string>constant.numeric</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Floats</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Boolean</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Constants</string>
<key>scope</key>
<string>constant</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Tags</string>
<key>scope</key>
<string>entity.name.tag</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#cc6666</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Attributes</string>
<key>scope</key>
<string>entity.other.attribute-name</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Attribute IDs</string>
<key>scope</key>
<string>entity.other.attribute-name.id, punctuation.definition.entity</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#81a2be</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Selector</string>
<key>scope</key>
<string>meta.selector</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Values</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Headings</string>
<key>scope</key>
<string>markup.heading punctuation.definition.heading, entity.name.section</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string></string>
<key>foreground</key>
<string>#81a2be</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Units</string>
<key>scope</key>
<string>keyword.other.unit</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Bold</string>
<key>scope</key>
<string>markup.bold, punctuation.definition.bold</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>bold</string>
<key>foreground</key>
<string>#f0c674</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Italic</string>
<key>scope</key>
<string>markup.italic, punctuation.definition.italic</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>italic</string>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Code</string>
<key>scope</key>
<string>markup.raw.inline</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b5bd68</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Link Text</string>
<key>scope</key>
<string>string.other.link, punctuation.definition.string.end.markdown, punctuation.definition.string.begin.markdown</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#cc6666</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Link Url</string>
<key>scope</key>
<string>meta.link</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Lists</string>
<key>scope</key>
<string>markup.list</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#cc6666</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Quotes</string>
<key>scope</key>
<string>markup.quote</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Separator</string>
<key>scope</key>
<string>meta.separator</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#373b41</string>
<key>foreground</key>
<string>#c5c8c6</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Inserted</string>
<key>scope</key>
<string>markup.inserted</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b5bd68</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#cc6666</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Changed</string>
<key>scope</key>
<string>markup.changed</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Colors</string>
<key>scope</key>
<string>constant.other.color</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#8abeb7</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Regular Expressions</string>
<key>scope</key>
<string>string.regexp</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#8abeb7</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Escape Characters</string>
<key>scope</key>
<string>constant.character.escape</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#8abeb7</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Embedded</string>
<key>scope</key>
<string>punctuation.section.embedded, variable.interpolation</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Illegal</string>
<key>scope</key>
<string>invalid.illegal</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#cc6666</string>
<key>foreground</key>
<string>#ffffff</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Broken</string>
<key>scope</key>
<string>invalid.broken</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#de935f</string>
<key>foreground</key>
<string>#1d1f21</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Deprecated</string>
<key>scope</key>
<string>invalid.deprecated</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#a3685a</string>
<key>foreground</key>
<string>#ffffff</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Unimplemented</string>
<key>scope</key>
<string>invalid.unimplemented</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#969896</string>
<key>foreground</key>
<string>#ffffff</string>
</dict>
</dict>
</array>
<key>uuid</key>
<string>uuid</string>
</dict>
</plist>

View File

@ -0,0 +1,560 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Template: Chris Kempson, Scheme: Chris Kempson (http://chriskempson.com)</string>
<key>name</key>
<string>Base16 Tomorrow Night</string>
<key>semanticClass</key>
<string>theme.base16.tomorrow-night</string>
<key>colorSpaceName</key>
<string>sRGB</string>
<key>gutterSettings</key>
<dict>
<key>background</key>
<string>#282a2e</string>
<key>divider</key>
<string>#282a2e</string>
<key>foreground</key>
<string>#969896</string>
<key>selectionBackground</key>
<string>#373b41</string>
<key>selectionForeground</key>
<string>#b4b7b4</string>
</dict>
<key>settings</key>
<array>
<dict>
<key>settings</key>
<dict>
<key>background</key>
<string>#1d1f21</string>
<key>caret</key>
<string>#c5c8c6</string>
<key>foreground</key>
<string>#c5c8c6</string>
<key>invisibles</key>
<string>#969896</string>
<key>lineHighlight</key>
<string>#96989655</string>
<key>selection</key>
<string>#373b41</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Text</string>
<key>scope</key>
<string>variable.parameter.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c5c8c6</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>comment, punctuation.definition.comment</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#969896</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Punctuation</string>
<key>scope</key>
<string>punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c5c8c6</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Delimiters</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c5c8c6</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Operators</string>
<key>scope</key>
<string>keyword.operator</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c5c8c6</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Keywords</string>
<key>scope</key>
<string>keyword</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Variables</string>
<key>scope</key>
<string>variable</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#cc6666</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Functions</string>
<key>scope</key>
<string>entity.name.function, meta.require, support.function.any-method</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#81a2be</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Labels</string>
<key>scope</key>
<string>entity.name.label</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#a3685a</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Classes</string>
<key>scope</key>
<string>support.class, entity.name.class, entity.name.type.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#f0c674</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Classes</string>
<key>scope</key>
<string>meta.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#ffffff</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Methods</string>
<key>scope</key>
<string>keyword.other.special-method</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#81a2be</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Storage</string>
<key>scope</key>
<string>storage</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Support</string>
<key>scope</key>
<string>support.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#8abeb7</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Strings, Inherited Class</string>
<key>scope</key>
<string>string, constant.other.symbol, entity.other.inherited-class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b5bd68</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Integers</string>
<key>scope</key>
<string>constant.numeric</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Floats</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Boolean</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Constants</string>
<key>scope</key>
<string>constant</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Tags</string>
<key>scope</key>
<string>entity.name.tag</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#cc6666</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Attributes</string>
<key>scope</key>
<string>entity.other.attribute-name</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Attribute IDs</string>
<key>scope</key>
<string>entity.other.attribute-name.id, punctuation.definition.entity</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#81a2be</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Selector</string>
<key>scope</key>
<string>meta.selector</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Values</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Headings</string>
<key>scope</key>
<string>markup.heading punctuation.definition.heading, entity.name.section</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string></string>
<key>foreground</key>
<string>#81a2be</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Units</string>
<key>scope</key>
<string>keyword.other.unit</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Bold</string>
<key>scope</key>
<string>markup.bold, punctuation.definition.bold</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>bold</string>
<key>foreground</key>
<string>#f0c674</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Italic</string>
<key>scope</key>
<string>markup.italic, punctuation.definition.italic</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>italic</string>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Code</string>
<key>scope</key>
<string>markup.raw.inline</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b5bd68</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Link Text</string>
<key>scope</key>
<string>string.other.link, punctuation.definition.string.end.markdown, punctuation.definition.string.begin.markdown</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#cc6666</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Link Url</string>
<key>scope</key>
<string>meta.link</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Lists</string>
<key>scope</key>
<string>markup.list</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#cc6666</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Quotes</string>
<key>scope</key>
<string>markup.quote</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#de935f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Separator</string>
<key>scope</key>
<string>meta.separator</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#373b41</string>
<key>foreground</key>
<string>#c5c8c6</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Inserted</string>
<key>scope</key>
<string>markup.inserted</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b5bd68</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#cc6666</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Changed</string>
<key>scope</key>
<string>markup.changed</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Colors</string>
<key>scope</key>
<string>constant.other.color</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#8abeb7</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Regular Expressions</string>
<key>scope</key>
<string>string.regexp</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#8abeb7</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Escape Characters</string>
<key>scope</key>
<string>constant.character.escape</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#8abeb7</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Embedded</string>
<key>scope</key>
<string>punctuation.section.embedded, variable.interpolation</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b294bb</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Illegal</string>
<key>scope</key>
<string>invalid.illegal</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#cc6666</string>
<key>foreground</key>
<string>#ffffff</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Broken</string>
<key>scope</key>
<string>invalid.broken</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#de935f</string>
<key>foreground</key>
<string>#1d1f21</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Deprecated</string>
<key>scope</key>
<string>invalid.deprecated</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#a3685a</string>
<key>foreground</key>
<string>#ffffff</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Unimplemented</string>
<key>scope</key>
<string>invalid.unimplemented</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#969896</string>
<key>foreground</key>
<string>#ffffff</string>
</dict>
</dict>
</array>
<key>uuid</key>
<string>uuid</string>
</dict>
</plist>

View File

@ -0,0 +1,549 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)</string>
<key>name</key>
<string>Base16 Atelier Dune Light</string>
<key>semanticClass</key>
<string>base16.atelierdune.light</string>
<key>colorSpaceName</key>
<string>sRGB</string>
<key>gutterSettings</key>
<dict>
<key>background</key>
<string>#fefbec</string>
<key>divider</key>
<string>#fefbec</string>
<key>foreground</key>
<string>#6e6b5e</string>
<key>selectionBackground</key>
<string>#fefbec</string>
<key>selectionForeground</key>
<string>#a6a28c</string>
</dict>
<key>settings</key>
<array>
<dict>
<key>settings</key>
<dict>
<key>background</key>
<string>#fefbec</string>
<key>caret</key>
<string>#6e6b5e</string>
<key>foreground</key>
<string>#6e6b5e</string>
<key>invisibles</key>
<string>#e8e4cf</string>
<key>lineHighlight</key>
<string>#99958055</string>
<key>selection</key>
<string>#e8e4cf</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Text</string>
<key>scope</key>
<string>variable.parameter.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#6e6b5e</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>comment, punctuation.definition.comment</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#999580</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Punctuation</string>
<key>scope</key>
<string>punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#6e6b5e</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Delimiters</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#6e6b5e</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Operators</string>
<key>scope</key>
<string>keyword.operator</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#6e6b5e</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Keywords</string>
<key>scope</key>
<string>keyword</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b854d4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Variables</string>
<key>scope</key>
<string>variable</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#d73737</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Functions</string>
<key>scope</key>
<string>entity.name.function, meta.require, support.function.any-method</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#6684e1</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Classes</string>
<key>scope</key>
<string>support.class, entity.name.class, entity.name.type.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b65611</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Classes</string>
<key>scope</key>
<string>meta.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#292824</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Methods</string>
<key>scope</key>
<string>keyword.other.special-method</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#6684e1</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Storage</string>
<key>scope</key>
<string>storage</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b854d4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Support</string>
<key>scope</key>
<string>support.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#1fad83</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Strings, Inherited Class</string>
<key>scope</key>
<string>string, constant.other.symbol, entity.other.inherited-class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#60ac39</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Integers</string>
<key>scope</key>
<string>constant.numeric</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b65611</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Floats</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b65611</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Boolean</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b65611</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Constants</string>
<key>scope</key>
<string>constant</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b65611</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Tags</string>
<key>scope</key>
<string>entity.name.tag</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#d73737</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Attributes</string>
<key>scope</key>
<string>entity.other.attribute-name</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b65611</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Attribute IDs</string>
<key>scope</key>
<string>entity.other.attribute-name.id, punctuation.definition.entity</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#6684e1</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Selector</string>
<key>scope</key>
<string>meta.selector</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b854d4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Values</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b65611</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Headings</string>
<key>scope</key>
<string>markup.heading punctuation.definition.heading, entity.name.section</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string></string>
<key>foreground</key>
<string>#6684e1</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Units</string>
<key>scope</key>
<string>keyword.other.unit</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b65611</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Bold</string>
<key>scope</key>
<string>markup.bold, punctuation.definition.bold</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>bold</string>
<key>foreground</key>
<string>#b65611</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Italic</string>
<key>scope</key>
<string>markup.italic, punctuation.definition.italic</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>italic</string>
<key>foreground</key>
<string>#b854d4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Code</string>
<key>scope</key>
<string>markup.raw.inline</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#60ac39</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Link Text</string>
<key>scope</key>
<string>string.other.link</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#d73737</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Link Url</string>
<key>scope</key>
<string>meta.link</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b65611</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Lists</string>
<key>scope</key>
<string>markup.list</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#d73737</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Quotes</string>
<key>scope</key>
<string>markup.quote</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b65611</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Separator</string>
<key>scope</key>
<string>meta.separator</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#e8e4cf</string>
<key>foreground</key>
<string>#6e6b5e</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Inserted</string>
<key>scope</key>
<string>markup.inserted</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#60ac39</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#d73737</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Changed</string>
<key>scope</key>
<string>markup.changed</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#b854d4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Colors</string>
<key>scope</key>
<string>constant.other.color</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#1fad83</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Regular Expressions</string>
<key>scope</key>
<string>string.regexp</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#1fad83</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Escape Characters</string>
<key>scope</key>
<string>constant.character.escape</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#1fad83</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Embedded</string>
<key>scope</key>
<string>punctuation.section.embedded, variable.interpolation</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#d43552</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Illegal</string>
<key>scope</key>
<string>invalid.illegal</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#d73737</string>
<key>foreground</key>
<string>#fefbec</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Broken</string>
<key>scope</key>
<string>invalid.broken</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#b65611</string>
<key>foreground</key>
<string>#20201d</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Deprecated</string>
<key>scope</key>
<string>invalid.deprecated</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#d43552</string>
<key>foreground</key>
<string>#fefbec</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Unimplemented</string>
<key>scope</key>
<string>invalid.unimplemented</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#a6a28c</string>
<key>foreground</key>
<string>#20201d</string>
</dict>
</dict>
</array>
<key>uuid</key>
<string>f2aa1936-a9d9-40c6-a1db-c64d058b81dd</string>
</dict>
</plist>

Binary file not shown.

View File

@ -1,16 +1,5 @@
# Note # Note
This folder is not copied over to the book directory when using `mdbook init`, nor is it indexed at runtime. To add new syntaxes, first add a `.sublime-syntax` file in this directory, then run (from inside this directory): This folder is not copied over to the book directory when using `mdbook init`, nor is it indexed at runtime. All of the files in this folder are scraped by build.rs.
```shell
$ ./gen-syntaxcache.sh
```
Make sure you have [`bat`](https://github.com/sharkdp/bat) installed, otherwise this won't work.
Don't worry if bat says: To make build.rs run again without running `cargo clean`, touch the run `touch build.rs`.
```
No themes were found in './themes', using the default set
```
Now, you may rebuild the `mdBook` binary and the new syntaxes should be included.
This only needs to be run when the syntaxes in this folder are updated.

View File

@ -1,6 +0,0 @@
#!/bin/env bash
set -Eeuxo pipefail
bat cache --build --source=".." --target=".."
rm -f ../themes.bin
rm -f ../metadata.yaml

View File

@ -341,6 +341,9 @@ impl<'a> SyntaxHighlighter<'a> {
r#"<pre class="playground"><code class="language-{}">"#, r#"<pre class="playground"><code class="language-{}">"#,
classes.join(" ") classes.join(" ")
))); )));
} else {
self.is_editable = false;
self.is_playground = false;
} }
} }
} else { } else {
@ -373,6 +376,7 @@ impl<'a> SyntaxHighlighter<'a> {
); );
let needs_wrapped = self.is_rust let needs_wrapped = self.is_rust
&& !(self.playground_config.editable && self.is_editable) && !(self.playground_config.editable && self.is_editable)
&& self.is_playground
&& !code.contains("fn main") && !code.contains("fn main")
&& !code.contains("quick_main!"); && !code.contains("quick_main!");
if needs_wrapped { if needs_wrapped {
@ -704,15 +708,15 @@ more text with spaces
("```rust\nfn main() {}\n```", ("```rust\nfn main() {}\n```",
"<pre class=\"playground\"><code class=\"language-rust\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"language-rust\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span></span><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></code></pre>"),
("```rust editable\nlet s = \"foo\n # bar\n\";\n```", ("```rust editable\nlet s = \"foo\n # bar\n\";\n```",
"<pre class=\"playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-assignment syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"),
("```rust editable\nlet s = \"foo\n ## bar\n\";\n```", ("```rust editable\nlet s = \"foo\n ## bar\n\";\n```",
"<pre class=\"playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-assignment syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> # bar\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> # bar\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"),
("```rust editable\nlet s = \"foo\n # bar\n#\n\";\n```", ("```rust editable\nlet s = \"foo\n # bar\n#\n\";\n```",
"<pre class=\"playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-assignment syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"),
("```rust ignore\nlet s = \"foo\n # bar\n\";\n```", ("```rust ignore\nlet s = \"foo\n # bar\n\";\n```",
"<pre><code class=\"language-rust ignore\"><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-storage syn-type syn-function syn-rust\">fn</span> </span><span class=\"syn-entity syn-name syn-function syn-rust\">main</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-begin syn-rust\">(</span></span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-function syn-parameters syn-rust\"><span class=\"syn-punctuation syn-section syn-parameters syn-end syn-rust\">)</span></span></span></span><span class=\"syn-meta syn-function syn-rust\"> </span><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-begin syn-rust\">{</span>\n</span></span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-assignment syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span></span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n</span></span></span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-function syn-rust\"><span class=\"syn-meta syn-block syn-rust\"><span class=\"syn-punctuation syn-section syn-block syn-end syn-rust\">}</span></span></span>\n</span></span></code></pre>"), "<pre><code class=\"language-rust ignore\"><span class=\"syn-source syn-rust\"><span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo\n</span></span><span class=\"boring\"><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"> bar\n</span></span></span><span class=\"syn-source syn-rust\"><span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n</span></code></pre>"),
("```rust editable\n#![no_std]\nlet s = \"foo\";\n #[some_attr]\n```", ("```rust editable\n#![no_std]\nlet s = \"foo\";\n #[some_attr]\n```",
"<pre class=\"playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-annotation syn-rust\"><span class=\"syn-punctuation syn-definition syn-annotation syn-rust\">#!</span><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">[</span><span class=\"syn-variable syn-annotation syn-rust\">no_std</span><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">]</span></span>\n<span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-assignment syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo<span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n <span class=\"syn-meta syn-annotation syn-rust\"><span class=\"syn-punctuation syn-definition syn-annotation syn-rust\">#</span><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">[</span><span class=\"syn-variable syn-annotation syn-rust\">some_attr</span><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">]</span></span>\n</span></code></pre>"), "<pre class=\"playground\"><code class=\"language-rust editable\"><span class=\"syn-source syn-rust\"><span class=\"syn-meta syn-annotation syn-rust\"><span class=\"syn-punctuation syn-definition syn-annotation syn-rust\">#!</span><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">[</span><span class=\"syn-variable syn-annotation syn-rust\">no_std</span><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">]</span></span>\n<span class=\"syn-storage syn-type syn-rust\">let</span> s <span class=\"syn-keyword syn-operator syn-rust\">=</span> <span class=\"syn-string syn-quoted syn-double syn-rust\"><span class=\"syn-punctuation syn-definition syn-string syn-begin syn-rust\">&quot;</span>foo<span class=\"syn-punctuation syn-definition syn-string syn-end syn-rust\">&quot;</span></span><span class=\"syn-punctuation syn-terminator syn-rust\">;</span>\n <span class=\"syn-meta syn-annotation syn-rust\"><span class=\"syn-punctuation syn-definition syn-annotation syn-rust\">#</span><span class=\"syn-punctuation syn-section syn-group syn-begin syn-rust\">[</span><span class=\"syn-variable syn-annotation syn-rust\">some_attr</span><span class=\"syn-punctuation syn-section syn-group syn-end syn-rust\">]</span></span>\n</span></code></pre>"),
]; ];
for (src, should_be) in &inputs { for (src, should_be) in &inputs {
let got = render_markdown( let got = render_markdown(
@ -812,7 +816,7 @@ more text with spaces
("```html,testhtml\n<p>\n```", ("```html,testhtml\n<p>\n```",
"<pre><code class=\"language-html testhtml\"><span class=\"syn-text syn-html syn-basic\"><span class=\"syn-meta syn-tag syn-block syn-any syn-html\"><span class=\"syn-punctuation syn-definition syn-tag syn-begin syn-html\">&lt;</span><span class=\"syn-entity syn-name syn-tag syn-block syn-any syn-html\">p</span><span class=\"syn-punctuation syn-definition syn-tag syn-end syn-html\">&gt;</span></span>\n</span></code></pre>"), "<pre><code class=\"language-html testhtml\"><span class=\"syn-text syn-html syn-basic\"><span class=\"syn-meta syn-tag syn-block syn-any syn-html\"><span class=\"syn-punctuation syn-definition syn-tag syn-begin syn-html\">&lt;</span><span class=\"syn-entity syn-name syn-tag syn-block syn-any syn-html\">p</span><span class=\"syn-punctuation syn-definition syn-tag syn-end syn-html\">&gt;</span></span>\n</span></code></pre>"),
("```js es7\nf()\n```", ("```js es7\nf()\n```",
"<pre><code class=\"language-js es7\"><span class=\"syn-source syn-js\"><span class=\"syn-meta syn-function-call syn-without-arguments syn-js\"><span class=\"syn-variable syn-function syn-js\">f</span><span class=\"syn-meta syn-group syn-braces syn-round syn-function syn-arguments syn-js\">()</span></span>\n</span></code></pre>"), "<pre><code class=\"language-js es7\"><span class=\"syn-source syn-js\"><span class=\"syn-meta syn-function-call syn-js\"><span class=\"syn-variable syn-function syn-js\">f</span><span class=\"syn-meta syn-group syn-js\"><span class=\"syn-punctuation syn-section syn-group syn-js\">(</span></span><span class=\"syn-meta syn-group syn-js\"><span class=\"syn-punctuation syn-section syn-group syn-js\">)</span></span></span>\n</span></code></pre>"),
]; ];
for (src, should_be) in &inputs { for (src, should_be) in &inputs {
let got = render_markdown( let got = render_markdown(

View File

@ -515,6 +515,44 @@ fn theme_dir_overrides_work_correctly() {
dummy_book::assert_contains_strings(built_index, &["This is a modified index.hbs!"]); dummy_book::assert_contains_strings(built_index, &["This is a modified index.hbs!"]);
} }
#[test]
fn theme_dir_syntaxesdotbin_prevents_default_highlighting() {
let book_dir = dummy_book::new_copy_of_example_book().unwrap();
let book_dir = book_dir.path();
let theme_dir = book_dir.join("theme");
let empty_syntaxset = syntect::parsing::SyntaxSet::new();
let empty_syntaxset_dump = syntect::dumps::dump_binary(&empty_syntaxset);
write_file(&theme_dir, "syntaxes.bin", &empty_syntaxset_dump).unwrap();
let md = MDBook::load(book_dir).unwrap();
md.build().unwrap();
let second = book_dir.join("book/format/mdbook.html");
assert_doesnt_contain_strings(&second, &["syn-rust", "rustmodifiedtestfixture"]);
}
#[test]
fn theme_dir_syntaxesdotbin_reads_syntaxes() {
let book_dir = dummy_book::new_copy_of_example_book().unwrap();
let book_dir = book_dir.path();
let theme_dir = book_dir.join("theme");
let syntaxset_test_fixture =
syntect::parsing::SyntaxSet::load_from_folder("tests/syntax_test_fixtures").unwrap();
let syntaxset_test_fixture = syntect::dumps::dump_binary(&syntaxset_test_fixture);
write_file(&theme_dir, "syntaxes.bin", &syntaxset_test_fixture).unwrap();
let md = MDBook::load(book_dir).unwrap();
md.build().unwrap();
let second = book_dir.join("book/format/mdbook.html");
assert_contains_strings(&second, &["syn-rustmodifiedtestfixture"]);
assert_doesnt_contain_strings(&second, &["syn-rust\""]);
}
#[test] #[test]
fn no_index_for_print_html() { fn no_index_for_print_html() {
let temp = DummyBook::new().build().unwrap(); let temp = DummyBook::new().build().unwrap();

View File

@ -0,0 +1,92 @@
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
#
# Based on https://github.com/sublimehq/Packages/tree/759d6eed9b4beed87e602a23303a121c3a6c2fb3/Rust
# but with rustmodifiedtestfixture added everywhere and somewhat truncated.
name: Rust
file_extensions:
- rs
scope: source.rustmodifiedtestfixture
variables:
identifier: '(?:(?:[[:alpha:]][_[:alnum:]]*|_[_[:alnum:]]+)\b)' # include a word boundary at the end to ensure all possible characters are consumed, to prevent catastrophic backtracking
escaped_byte: '\\(x\h{2}|n|r|t|0|"|''|\\)'
escaped_char: '\\(x\h{2}|n|r|t|0|"|''|\\|u\{\h{1,6}\})'
int_suffixes: 'i8|i16|i32|i64|i128|isize|u8|u16|u32|u64|u128|usize'
support_type: \b(Copy|Send|Sized|Sync|Drop|Fn|FnMut|FnOnce|Box|ToOwned|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator|Option|Some|None|Result|Ok|Err|SliceConcatExt|String|ToString|Vec)\b
contexts:
main:
- include: statements
prototype:
# Macro metavariables. Ideally we would do this as a with_prototype,
# however then we run into infinite recursion. It needs to be a prototype
# since macro_rules! allows constructing new code, thus the metavariables
# can be inserted in just about any position in the syntax.
- match: '\${{identifier}}'
scope: variable.other.rustmodifiedtestfixture
else-pop:
- match: (?=\S)
pop: true
pop-immediately:
- match: ''
pop: true
statements:
- match: '(''{{identifier}})\s*(:)'
captures:
1: entity.name.label.rustmodifiedtestfixture
2: punctuation.separator.rustmodifiedtestfixture
- match: '''{{identifier}}(?!\'')\b'
scope: storage.modifier.lifetime.rustmodifiedtestfixture
- match: '\b(?:(pub)\s+)?\b(mod)\s+({{identifier}})\b'
captures:
1: storage.modifier.rustmodifiedtestfixture
2: storage.type.module.rustmodifiedtestfixture
3: entity.name.module.rustmodifiedtestfixture
- match: '\b({{identifier}})\s*(=)\s*(?=\|)'
captures:
1: entity.name.function.rustmodifiedtestfixture
2: keyword.operator.rustmodifiedtestfixture
- match: '\b(?:(pub)\s+)?\b(fn)\s+(?={{identifier}})'
scope: meta.function.rustmodifiedtestfixture
captures:
1: storage.modifier.rustmodifiedtestfixture
2: storage.type.function.rustmodifiedtestfixture
- match: '\b(?:(pub)\s+)?(struct)\s+'
scope: meta.struct.rustmodifiedtestfixture
captures:
1: storage.modifier.rustmodifiedtestfixture
2: storage.type.struct.rustmodifiedtestfixture
- match: '\b(?:(pub)\s+)?(type)\s+({{identifier}})\b'
captures:
1: storage.modifier.rustmodifiedtestfixture
2: storage.type.type.rustmodifiedtestfixture
3: entity.name.type.rustmodifiedtestfixture
- match: '\b(?:(pub)\s+)?(trait)\s+({{identifier}})\b'
captures:
1: storage.modifier.rustmodifiedtestfixture
2: storage.type.trait.rustmodifiedtestfixture
3: entity.name.trait.rustmodifiedtestfixture
- match: '\bimpl\b'
scope: storage.type.impl.rustmodifiedtestfixture
- match: '\b(?:(pub)\s+)?(enum)\s+({{identifier}})\b'
captures:
1: storage.modifier.rustmodifiedtestfixture
2: storage.type.enum.rustmodifiedtestfixture
3: entity.name.enum.rustmodifiedtestfixture
- match: \b(let|const|static)\b
scope: storage.type.rustmodifiedtestfixture