Struct markdown_it::parser::linkfmt::MDLinkFormatter
source · pub struct MDLinkFormatter;
Expand description
Default link validator and formatter for markdown-it.
This validator can prohibit more than really needed to prevent XSS. It’s a tradeoff to keep code simple and to be secure by default.
If you need different setup - override validator method as you wish. Or replace it with dummy function and use external sanitizer.
Implementations§
Trait Implementations§
source§impl Debug for MDLinkFormatter
impl Debug for MDLinkFormatter
source§impl Default for MDLinkFormatter
impl Default for MDLinkFormatter
source§fn default() -> MDLinkFormatter
fn default() -> MDLinkFormatter
Returns the “default value” for a type. Read more
source§impl LinkFormatter for MDLinkFormatter
impl LinkFormatter for MDLinkFormatter
source§fn validate_link(&self, url: &str) -> Option<()>
fn validate_link(&self, url: &str) -> Option<()>
Validate link url, return
Some(())
if it is allowed
and None
if it is a security risk.source§fn normalize_link(&self, url: &str) -> String
fn normalize_link(&self, url: &str) -> String
Encode link url to a machine-readable format,
which includes url-encoding, punycode, etc.
source§fn normalize_link_text(&self, url: &str) -> String
fn normalize_link_text(&self, url: &str) -> String
Decode link url to a human-readable format.
Auto Trait Implementations§
impl RefUnwindSafe for MDLinkFormatter
impl Send for MDLinkFormatter
impl Sync for MDLinkFormatter
impl Unpin for MDLinkFormatter
impl UnwindSafe for MDLinkFormatter
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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.