Trait pagetop_hljs::HljsContext
source · pub trait HljsContext {
// Required methods
fn enable_hljs(&mut self);
fn disable_hljs(&mut self);
fn force_hljs_mode(&mut self, mode: &HljsMode);
fn add_hljs_language(&mut self, language: &HljsLang);
fn set_hljs_theme(&mut self, theme: &HljsTheme);
fn is_hljs_enabled(&self) -> bool;
fn hljs_mode(&self) -> HljsMode;
fn hljs_languages(&self) -> Option<HashSet<String>>;
fn hljs_theme(&self) -> HljsTheme;
}
Expand description
Extend Context with HighlightJS features.
Required Methods§
sourcefn enable_hljs(&mut self)
fn enable_hljs(&mut self)
Enable syntax highlighting in current context.
sourcefn disable_hljs(&mut self)
fn disable_hljs(&mut self)
Preventing syntax highlighting in current context.
sourcefn force_hljs_mode(&mut self, mode: &HljsMode)
fn force_hljs_mode(&mut self, mode: &HljsMode)
Force the use of the highlight.js core or common mode in current context,
ignoring the config::SETTINGS.hljs.mode
configuration setting.
sourcefn add_hljs_language(&mut self, language: &HljsLang)
fn add_hljs_language(&mut self, language: &HljsLang)
Add a new language to the context for processing code snippets. It is necessary to add at
least one language to load the highlight.js library. Each Snippet
component automatically adds its required language.
sourcefn set_hljs_theme(&mut self, theme: &HljsTheme)
fn set_hljs_theme(&mut self, theme: &HljsTheme)
Change the theme in current context for displaying code snippets. The same theme is used for all snippets in the given context.