mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Switch to two-face
for extra syntect syntaxes (#2937)
This commit is contained in:
parent
754e1788b2
commit
56159997b7
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -2645,6 +2645,17 @@ version = "0.19.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1"
|
checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "two-face"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "37bed2135b2459c7eefba72c906d374697eb15949c205f2f124e3636a46b5eeb"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
"serde",
|
||||||
|
"syntect",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typed-arena"
|
name = "typed-arena"
|
||||||
version = "2.0.2"
|
version = "2.0.2"
|
||||||
@ -2692,6 +2703,7 @@ dependencies = [
|
|||||||
"toml",
|
"toml",
|
||||||
"tracing",
|
"tracing",
|
||||||
"ttf-parser",
|
"ttf-parser",
|
||||||
|
"two-face",
|
||||||
"typed-arena",
|
"typed-arena",
|
||||||
"typst-macros",
|
"typst-macros",
|
||||||
"typst-syntax",
|
"typst-syntax",
|
||||||
|
@ -104,6 +104,7 @@ tracing-error = "0.2"
|
|||||||
tracing-flame = "0.2.0"
|
tracing-flame = "0.2.0"
|
||||||
tracing-subscriber = "0.3.17"
|
tracing-subscriber = "0.3.17"
|
||||||
ttf-parser = "0.19.2"
|
ttf-parser = "0.19.2"
|
||||||
|
two-face = { version = "0.3.0", default-features = false, features = ["syntect-fancy"] }
|
||||||
typed-arena = "2"
|
typed-arena = "2"
|
||||||
unicode_names2 = "1.2"
|
unicode_names2 = "1.2"
|
||||||
unicode-bidi = "0.3.13"
|
unicode-bidi = "0.3.13"
|
||||||
|
2
NOTICE
2
NOTICE
@ -215,7 +215,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Syntaxes in `crates/typst-library/assets/syntect.bin` are generated from syntax
|
Syntaxes embedded within the `two-face` crate are generated from syntax
|
||||||
definitions which can be found here:
|
definitions which can be found here:
|
||||||
https://github.com/sharkdp/bat/tree/master/assets/syntaxes
|
https://github.com/sharkdp/bat/tree/master/assets/syntaxes
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ time = { workspace = true }
|
|||||||
toml = { workspace = true }
|
toml = { workspace = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
ttf-parser = { workspace = true }
|
ttf-parser = { workspace = true }
|
||||||
|
two-face = { workspace = true }
|
||||||
typed-arena = { workspace = true }
|
typed-arena = { workspace = true }
|
||||||
unicode-bidi = { workspace = true }
|
unicode-bidi = { workspace = true }
|
||||||
unicode-math-class = { workspace = true }
|
unicode-math-class = { workspace = true }
|
||||||
|
Binary file not shown.
@ -734,31 +734,10 @@ fn parse_theme(
|
|||||||
|
|
||||||
/// The syntect syntax definitions.
|
/// The syntect syntax definitions.
|
||||||
///
|
///
|
||||||
/// Code for syntax set generation is below. The `syntaxes` directory is from
|
/// Syntax set is generated from the syntaxes from the `bat` project
|
||||||
/// <https://github.com/sharkdp/bat/tree/master/assets/syntaxes>
|
/// <https://github.com/sharkdp/bat/tree/master/assets/syntaxes>
|
||||||
///
|
|
||||||
/// ```ignore
|
|
||||||
/// fn main() {
|
|
||||||
/// let mut builder = syntect::parsing::SyntaxSet::load_defaults_nonewlines().into_builder();
|
|
||||||
/// builder.add_from_folder("syntaxes/02_Extra", false).unwrap();
|
|
||||||
/// syntect::dumps::dump_to_file(&builder.build(), "syntect.bin").unwrap();
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// The following syntaxes are disabled due to compatibility issues:
|
|
||||||
/// ```text
|
|
||||||
/// syntaxes/02_Extra/Assembly (ARM).sublime-syntax
|
|
||||||
/// syntaxes/02_Extra/Elixir/Regular Expressions (Elixir).sublime-syntax
|
|
||||||
/// syntaxes/02_Extra/JavaScript (Babel).sublime-syntax
|
|
||||||
/// syntaxes/02_Extra/LiveScript.sublime-syntax
|
|
||||||
/// syntaxes/02_Extra/PowerShell.sublime-syntax
|
|
||||||
/// syntaxes/02_Extra/SCSS_Sass/Syntaxes/Sass.sublime-syntax
|
|
||||||
/// syntaxes/02_Extra/SLS/SLS.sublime-syntax
|
|
||||||
/// syntaxes/02_Extra/VimHelp.sublime-syntax
|
|
||||||
/// syntaxes/02_Extra/cmd-help/syntaxes/cmd-help.sublime-syntax
|
|
||||||
/// ```
|
|
||||||
pub static RAW_SYNTAXES: Lazy<syntect::parsing::SyntaxSet> =
|
pub static RAW_SYNTAXES: Lazy<syntect::parsing::SyntaxSet> =
|
||||||
Lazy::new(|| syntect::dumps::from_binary(include_bytes!("../../assets/syntect.bin")));
|
Lazy::new(two_face::syntax::extra_no_newlines);
|
||||||
|
|
||||||
/// The default theme used for syntax highlighting.
|
/// The default theme used for syntax highlighting.
|
||||||
pub static RAW_THEME: Lazy<synt::Theme> = Lazy::new(|| synt::Theme {
|
pub static RAW_THEME: Lazy<synt::Theme> = Lazy::new(|| synt::Theme {
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 39 KiB |
Loading…
x
Reference in New Issue
Block a user