Function syntastica::highlight
source · pub fn highlight<S, T, E>(
code: impl AsRef<str>,
language: S::Language,
language_set: &S,
renderer: &mut impl Renderer,
theme: T
) -> Result<String>where
S: LanguageSet,
T: TryInto<ResolvedTheme, Error = E>,
Error: From<E>,
Expand description
Convenience function for processing and directly rendering code once.
Only use this function if you do not plan to highlight multiple inputs!
When planning to render the same input multiple times, use Processor::process_once
instead.
When planning to process multiple different inputs with the same LanguageSet
, use a
Processor
and call Processor::process
for each input.
Errors
The function may error in the following situations:
Processor::process_once
returns an error.- The
TryInto<ResolvedTheme>
implementation onT
errors. IfT
isTheme
, look atTheme::resolve_links
for when this might happen.