Skip to main content

init_code_highlighting

Function init_code_highlighting 

Source
pub fn init_code_highlighting(cx: &mut App)
Expand description

Turn on syntax highlighting for markdown code blocks.

Call once during app setup, after gpuikit::init. Without it, fenced code blocks render as plain monospace — which is the right default, since loading syntect’s syntax and theme sets is not free and a document with no code in it should not pay for them.

Calling it twice replaces the highlighter, discarding the cache.

Application::with_platform(gpui_platform::current_platform(false)).run(|cx| {
    gpuikit::init(cx);
    gpuikit::markdown::init_code_highlighting(cx);
});