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 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

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

impl Default for CommonMarkCache

Source§

fn default() -> Self

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.