Skip to main content

Module advanced

Module advanced 

Source
Expand description

Advanced building blocks for custom syntax-highlighted renderers.

Most users should use Code(). This module exposes the lower-level source, span, segment, and theme helpers used by companion components such as dioxus-code-editor.

use dioxus_code::Language;
use dioxus_code::advanced::{HighlightSpan, HighlightedSource};
static SPANS: &[HighlightSpan] = &[HighlightSpan::new(0..2, "k")];
let src = HighlightedSource::from_static_parts("fn main() {}", Language::Rust, SPANS);
assert_eq!(src.spans().len(), 1);

Re-exports§

pub use CodeThemeStyles_completions::Component::CodeThemeStyles;

Structs§

Bufferruntime
A live (text, grammar) pair you can edit, reparse, and snapshot.
CodeThemeStylesProps
Properties for the CodeThemeStyles component.
HighlightSegment
A borrowed render segment with an optional highlight tag.
HighlightSpan
A highlight span attached to a byte range of source text.
HighlightedSource
A highlighted source string with metadata and token spans.
SourceEditruntime
A byte-range edit description used to drive incremental highlighting.
TokenSpanProps
Props for TokenSpan.

Enums§

HighlightError
A typed error produced while preparing runtime syntax highlighting.
HighlightQueryErrorKind
The category of a tree-sitter highlights query compilation error.

Functions§

CodeThemeStyles
Inject the shared syntax theme stylesheet and selected theme stylesheet.
TokenSpan
Render one highlighted token as <span class="a-{tag}">{text}</span>.