Browse Source

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

index-subcmd
William Yao 7 years ago
parent
commit
2109787625
4 changed files with 11 additions and 13 deletions
  1. +10
    -0
      src/rendering/highlighting.rs
  2. +1
    -2
      src/rendering/markdown.rs
  3. +0
    -1
      src/rendering/mod.rs
  4. +0
    -10
      src/rendering/parsing.rs

+ 10
- 0
src/rendering/highlighting.rs View File

@@ -1,6 +1,16 @@
use syntect::dumps::from_binary;
use syntect::parsing::SyntaxSet;
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!{
pub static ref THEME_SET: ThemeSet = from_binary(include_bytes!("../../sublime_themes/all.themedump"));
}


+ 1
- 2
src/rendering/markdown.rs View File

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



+ 0
- 1
src/rendering/mod.rs View File

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

+ 0
- 10
src/rendering/parsing.rs 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
};
}

Loading…
Cancel
Save