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§

source

fn enable_hljs(&mut self)

Enable syntax highlighting in current context.

source

fn disable_hljs(&mut self)

Preventing syntax highlighting in current context.

source

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.

source

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.

source

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.

source

fn is_hljs_enabled(&self) -> bool

source

fn hljs_mode(&self) -> HljsMode

source

fn hljs_languages(&self) -> Option<HashSet<String>>

source

fn hljs_theme(&self) -> HljsTheme

Implementations on Foreign Types§

source§

impl HljsContext for Context

Implementors§