pub struct CommonMarkCache { /* private fields */ }
Expand description
A cache used for storing content such as images.
Implementations§
Source§impl CommonMarkCache
impl CommonMarkCache
Sourcepub fn clear_scrollable(&mut self)
pub fn clear_scrollable(&mut self)
Clear the cache for all scrollable elements
Sourcepub fn clear_scrollable_with_id(&mut self, source_id: impl Hash) -> bool
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.
Sourcepub fn add_link_hook<S: Into<String>>(&mut self, name: S)
pub fn add_link_hook<S: Into<String>>(&mut self, name: S)
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
§Why use link hooks
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.
Sourcepub fn remove_link_hook(&mut self, name: &str) -> Option<bool>
pub fn remove_link_hook(&mut self, name: &str) -> Option<bool>
Returns None if the link hook could not be found. Returns the last known status of the hook otherwise.
Sourcepub fn get_link_hook(&self, name: &str) -> Option<bool>
pub fn get_link_hook(&self, name: &str) -> Option<bool>
Get status of link. Returns true if it was clicked
Sourcepub fn link_hooks_clear(&mut self)
pub fn link_hooks_clear(&mut self)
Remove all link hooks
Sourcepub fn link_hooks(&self) -> &HashMap<String, bool>
pub fn link_hooks(&self) -> &HashMap<String, bool>
All link hooks
Sourcepub fn link_hooks_mut(&mut self) -> &mut HashMap<String, bool>
pub fn link_hooks_mut(&mut self) -> &mut HashMap<String, bool>
Raw access to link hooks