pub struct SyntectWriter<'a, W>where
W: 'a + StrWrite,{ /* private fields */ }
Expand description
An HTML writer implementation. This type implements methods for writing HTML elements. Writer that adds syntax highlighting to code blocks
Implementations§
Source§impl<'a, W: StrWrite> SyntectWriter<'a, W>
impl<'a, W: StrWrite> SyntectWriter<'a, W>
pub fn new(writer: W, config: &'a HtmlConfig) -> Self
pub fn with_custom_sets( writer: W, config: &'a HtmlConfig, syntax_set: Option<&'a SyntaxSet>, theme_set: Option<&'a ThemeSet>, ) -> Self
pub fn get_theme_css(&self) -> Result<String, String>
Trait Implementations§
Source§impl<'a, W> HtmlWriter<W> for SyntectWriter<'a, W>where
W: 'a + StrWrite,
impl<'a, W> HtmlWriter<W> for SyntectWriter<'a, W>where
W: 'a + StrWrite,
fn get_writer(&mut self) -> &mut W
fn get_config(&self) -> &HtmlConfig
fn get_state(&mut self) -> &mut HtmlState
Source§fn write_str(&mut self, s: &str) -> Result<(), HtmlError>
fn write_str(&mut self, s: &str) -> Result<(), HtmlError>
Write a string directly to the output
Source§fn write_attributes(&mut self, element: &str) -> Result<(), HtmlError>
fn write_attributes(&mut self, element: &str) -> Result<(), HtmlError>
Write HTML attributes for a given element
Source§fn is_external_link(&self, url: &str) -> bool
fn is_external_link(&self, url: &str) -> bool
Check if a URL points to an external resource
fn start_paragraph(&mut self) -> Result<(), HtmlError>
fn end_paragraph(&mut self) -> Result<(), HtmlError>
fn start_heading( &mut self, level: HeadingLevel, id: Option<&str>, classes: &[CowStr<'_>], attrs: &Vec<(CowStr<'_>, Option<CowStr<'_>>)>, ) -> Result<(), HtmlError>
fn end_heading(&mut self, level: HeadingLevel) -> Result<(), HtmlError>
fn start_blockquote(&mut self) -> Result<(), HtmlError>
fn end_blockquote(&mut self) -> Result<(), HtmlError>
fn start_code_block(&mut self, kind: CodeBlockKind<'_>) -> Result<(), HtmlError>
fn end_code_block(&mut self) -> Result<(), HtmlError>
fn start_inline_code(&mut self) -> Result<(), HtmlError>
fn end_inline_code(&mut self) -> Result<(), HtmlError>
fn start_list(&mut self, first_number: Option<u64>) -> Result<(), HtmlError>
fn end_list(&mut self, ordered: bool) -> Result<(), HtmlError>
fn start_list_item(&mut self) -> Result<(), HtmlError>
fn end_list_item(&mut self) -> Result<(), HtmlError>
fn start_table(&mut self, alignments: Vec<Alignment>) -> Result<(), HtmlError>
fn end_table(&mut self) -> Result<(), HtmlError>
fn start_table_head(&mut self) -> Result<(), HtmlError>
fn end_table_head(&mut self) -> Result<(), HtmlError>
fn start_table_row(&mut self) -> Result<(), HtmlError>
fn end_table_row(&mut self) -> Result<(), HtmlError>
fn start_table_cell(&mut self) -> Result<(), HtmlError>
fn end_table_cell(&mut self) -> Result<(), HtmlError>
fn start_emphasis(&mut self) -> Result<(), HtmlError>
fn end_emphasis(&mut self) -> Result<(), HtmlError>
fn start_strong(&mut self) -> Result<(), HtmlError>
fn end_strong(&mut self) -> Result<(), HtmlError>
fn start_strikethrough(&mut self) -> Result<(), HtmlError>
fn end_strikethrough(&mut self) -> Result<(), HtmlError>
fn start_link( &mut self, _link_type: LinkType, dest: &str, title: &str, ) -> Result<(), HtmlError>
fn end_link(&mut self) -> Result<(), HtmlError>
fn start_image<'a, I>( &mut self, _link_type: LinkType, dest: &str, title: &str, iter: &mut Peekable<I>, ) -> Result<(), HtmlError>
fn end_image(&mut self) -> Result<(), HtmlError>
fn footnote_reference(&mut self, name: &str) -> Result<(), HtmlError>
fn start_footnote_definition(&mut self, name: &str) -> Result<(), HtmlError>
fn end_footnote_definition(&mut self) -> Result<(), HtmlError>
fn task_list_item(&mut self, checked: bool) -> Result<(), HtmlError>
fn horizontal_rule(&mut self) -> Result<(), HtmlError>
fn soft_break(&mut self) -> Result<(), HtmlError>
fn hard_break(&mut self) -> Result<(), HtmlError>
fn text(&mut self, text: &str) -> Result<(), HtmlError>
fn start_definition_list(&mut self) -> Result<(), HtmlError>
fn end_definition_list(&mut self) -> Result<(), HtmlError>
fn start_definition_list_title(&mut self) -> Result<(), HtmlError>
fn end_definition_list_title(&mut self) -> Result<(), HtmlError>
fn start_definition_list_definition(&mut self) -> Result<(), HtmlError>
fn end_definition_list_definition(&mut self) -> Result<(), HtmlError>
fn start_metadata_block( &mut self, _metadata_type: &MetadataBlockKind, ) -> Result<(), HtmlError>
fn end_metadata_block(&mut self) -> Result<(), HtmlError>
fn html_raw(&mut self, html: &CowStr<'_>) -> Result<(), HtmlError>
fn collect_alt_text<'a, I>(&self, iter: &mut Peekable<I>) -> String
Auto Trait Implementations§
impl<'a, W> Freeze for SyntectWriter<'a, W>where
W: Freeze,
impl<'a, W> RefUnwindSafe for SyntectWriter<'a, W>where
W: RefUnwindSafe,
impl<'a, W> Send for SyntectWriter<'a, W>where
W: Send,
impl<'a, W> Sync for SyntectWriter<'a, W>where
W: Sync,
impl<'a, W> Unpin for SyntectWriter<'a, W>where
W: Unpin,
impl<'a, W> UnwindSafe for SyntectWriter<'a, W>where
W: UnwindSafe,
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