coalesce syntect data structures into rendering::highlighting (Keats/gutenberg#89)

This commit is contained in:
William Yao 2017-06-20 00:42:56 -05:00
parent b759cf7681
commit 2109787625
4 changed files with 11 additions and 13 deletions

View file

@ -1,6 +1,16 @@
use syntect::dumps::from_binary; use syntect::dumps::from_binary;
use syntect::parsing::SyntaxSet;
use syntect::highlighting::ThemeSet; use syntect::highlighting::ThemeSet;
thread_local!{
pub static SYNTAX_SET: SyntaxSet = {
let mut ss: SyntaxSet = from_binary(include_bytes!("../../sublime_syntaxes/newlines.packdump"));
ss.link_syntaxes();
ss
};
}
lazy_static!{ lazy_static!{
pub static ref THEME_SET: ThemeSet = from_binary(include_bytes!("../../sublime_themes/all.themedump")); pub static ref THEME_SET: ThemeSet = from_binary(include_bytes!("../../sublime_themes/all.themedump"));
} }

View file

@ -12,8 +12,7 @@ use errors::{Result};
use site::resolve_internal_link; use site::resolve_internal_link;
use front_matter::InsertAnchor; use front_matter::InsertAnchor;
use rendering::context::Context; use rendering::context::Context;
use rendering::highlighting::THEME_SET; use rendering::highlighting::{SYNTAX_SET, THEME_SET};
use rendering::parsing::SYNTAX_SET;
use rendering::short_code::{ShortCode, parse_shortcode, render_simple_shortcode}; use rendering::short_code::{ShortCode, parse_shortcode, render_simple_shortcode};
use content::{TempHeader, Header, make_table_of_contents}; use content::{TempHeader, Header, make_table_of_contents};

View file

@ -1,5 +1,4 @@
pub mod highlighting; pub mod highlighting;
pub mod parsing;
pub mod markdown; pub mod markdown;
pub mod short_code; pub mod short_code;
pub mod context; pub mod context;

View file

@ -1,10 +0,0 @@
use syntect::parsing::SyntaxSet;
use syntect::dumps::from_binary;
thread_local! {
pub static SYNTAX_SET: SyntaxSet = {
let mut ss: SyntaxSet = from_binary(include_bytes!("../../sublime_syntaxes/newlines.packdump"));
ss.link_syntaxes();
ss
};
}