1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! Native TextMate syntax highlighting with Shiki-compatible language and theme bundles.
//!
//! Grammars are compiled into numeric runtime structures and matched with Oniguruma.
//! Bundled definitions live in the companion `shiki-langs` and `shiki-themes` crates;
//! runtime TextMate JSON is supported through [`HighlighterBuilder::json_language`] and
//! [`HighlighterBuilder::json_theme`]. Reuse a [`Highlighter`] or [`HighlighterEngine`]
//! because compiled scanners and scope/style transitions are cached on demand.
//!
//! # Basic highlighting
//!
//! ```ignore
//! use shiki::{Highlighter, LanguageBundle};
//!
//! static LANGUAGES: LanguageBundle = shiki_langs::languages![rust];
//!
//! let mut highlighter = Highlighter::builder()
//! .bundle(&LANGUAGES)
//! .languages(["rust"])
//! .theme(&shiki_themes::CATPPUCCIN_MOCHA)
//! .build()?;
//!
//! let html = highlighter.code_to_html("fn main() {}", "rust")?;
//! assert!(html.contains("fn"));
//! # Ok::<(), shiki::Error>(())
//! ```
//!
//! # Enabling every bundled language
//!
//! `shiki_langs::all()` provides the convenient all-language bundle. Building it is
//! intentionally more expensive, so applications should normally create one shared engine.
//!
//! ```ignore
//! use shiki::Highlighter;
//!
//! let languages = shiki_langs::all();
//! let engine = Highlighter::builder()
//! .bundle(&languages)
//! .theme(&shiki_themes::CATPPUCCIN_MOCHA)
//! .build_engine()?;
//!
//! let mut highlighter = engine.highlighter();
//! let html = highlighter.code_to_html("const value = 1", "javascript")?;
//! # Ok::<(), shiki::Error>(())
//! ```
//!
//! # Incremental documents and parallel sessions
//!
//! An engine shares immutable grammar IR and themes. Each session owns its dynamic scanner,
//! scope and style caches, so documents can advance independently.
//!
//! ```ignore
//! use shiki::{Highlighter, LanguageBundle};
//!
//! static LANGUAGES: LanguageBundle = shiki_langs::languages![rust];
//! let engine = Highlighter::builder()
//! .bundle(&LANGUAGES)
//! .languages(["rust"])
//! .theme(&shiki_themes::GITHUB_DARK)
//! .build_engine()?;
//!
//! let mut session = engine.session("rust")?;
//! let mut state = session.initial_state();
//! let tokens = session.tokenize_line("/* open", &mut state, true)?;
//! assert!(!tokens.is_empty());
//! # Ok::<(), shiki::Error>(())
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;