egui_commonmark

Struct CommonMarkCache

source
pub struct CommonMarkCache { /* private fields */ }
Expand description

A cache used for storing content such as images.

Implementations§

source§

impl CommonMarkCache

source

pub fn add_syntax_from_folder(&mut self, path: &str)

source

pub fn add_syntax_from_str(&mut self, s: &str, fallback_name: Option<&str>)

source

pub fn add_syntax_themes_from_folder( &mut self, path: impl AsRef<Path>, ) -> Result<(), LoadingError>

Add more color themes for code blocks(.tmTheme files). Set the color theme with syntax_theme_dark and syntax_theme_light

source

pub fn add_syntax_theme_from_bytes( &mut self, name: impl Into<String>, bytes: &[u8], ) -> Result<(), LoadingError>

Add color theme for code blocks(.tmTheme files). Set the color theme with syntax_theme_dark and syntax_theme_light

source

pub fn clear_scrollable(&mut self)

Clear the cache for all scrollable elements

source

pub fn clear_scrollable_with_id(&mut self, source_id: impl Hash) -> bool

Clear the cache for a specific scrollable viewer. Returns false if the id was not in the cache.

If the user clicks on a link in the markdown render that has name as a link. The hook specified with this method will be set to true. It’s status can be acquired with get_link_hook. Be aware that all hook state is reset once [CommonMarkViewer::show] gets called

egui provides a method for checking links afterwards so why use this instead?

ctx.output_mut(|o| o.open_url.is_some());

The main difference is that link hooks allows egui_commonmark to check for link hooks while rendering. Normally when hovering over a link, egui_commonmark will display the full url. With link hooks this feature is disabled, but to do that all hooks must be known.

Returns None if the link hook could not be found. Returns the last known status of the hook otherwise.

Get status of link. Returns true if it was clicked

Remove all link hooks

All link hooks

Raw access to link hooks

Trait Implementations§

source§

impl Debug for CommonMarkCache

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for CommonMarkCache

source§

fn default() -> CommonMarkCache

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.