pub struct SyntaxHighlightEngine;Expand description
Pure-Rust lightweight pattern-based code block syntax extractor & highlighter engine.
Implementations§
Source§impl SyntaxHighlightEngine
impl SyntaxHighlightEngine
Sourcepub fn parse_code(code: &str, _language: &str) -> Vec<SyntaxNodeInfo>
pub fn parse_code(code: &str, _language: &str) -> Vec<SyntaxNodeInfo>
Tokenize source code snippet into line-based syntax nodes with basic structural error checking.
Sourcepub fn extract_code_blocks(book: &Book) -> Vec<ExtractedCodeBlock>
pub fn extract_code_blocks(book: &Book) -> Vec<ExtractedCodeBlock>
Extract all embedded code blocks (<pre><code> or code) from a Book instance.
Sourcepub fn highlight_code_blocks(html: &str) -> String
pub fn highlight_code_blocks(html: &str) -> String
Transform raw <pre><code> blocks in section HTML into Tree-sitter highlighted markup.
Auto Trait Implementations§
impl Freeze for SyntaxHighlightEngine
impl RefUnwindSafe for SyntaxHighlightEngine
impl Send for SyntaxHighlightEngine
impl Sync for SyntaxHighlightEngine
impl Unpin for SyntaxHighlightEngine
impl UnsafeUnpin for SyntaxHighlightEngine
impl UnwindSafe for SyntaxHighlightEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more