pub struct SanitizerConfig {
pub extra_tags: Vec<String>,
pub extra_tag_attributes: HashMap<String, Vec<String>>,
pub extra_generic_attributes: Vec<String>,
pub extra_allowed_classes: HashMap<String, Vec<String>>,
}Expand description
User-supplied extensions to the default HTML sanitizer allow-list.
Each field is additive: values here are merged on top of the
defaults that ship with mdx-gen. Wire an instance into
MarkdownOptions::with_sanitizer_config.
Fields§
Additional tags to allow (beyond the defaults).
extra_tag_attributes: HashMap<String, Vec<String>>Additional attributes per tag, in the form tag -> attrs.
extra_generic_attributes: Vec<String>Additional generic attributes that may appear on any tag.
extra_allowed_classes: HashMap<String, Vec<String>>Additional allowed class values per tag.
Implementations§
Source§impl SanitizerConfig
impl SanitizerConfig
Sourcepub fn with_tag_attribute(
self,
tag: impl Into<String>,
attr: impl Into<String>,
) -> Self
pub fn with_tag_attribute( self, tag: impl Into<String>, attr: impl Into<String>, ) -> Self
Adds one extra attribute for a specific tag.
Sourcepub fn with_generic_attribute(self, attr: impl Into<String>) -> Self
pub fn with_generic_attribute(self, attr: impl Into<String>) -> Self
Adds one extra generic attribute (applies to any allowed tag).
Trait Implementations§
Source§impl Clone for SanitizerConfig
impl Clone for SanitizerConfig
Source§fn clone(&self) -> SanitizerConfig
fn clone(&self) -> SanitizerConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SanitizerConfig
impl Debug for SanitizerConfig
Source§impl Default for SanitizerConfig
impl Default for SanitizerConfig
Source§fn default() -> SanitizerConfig
fn default() -> SanitizerConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SanitizerConfig
impl RefUnwindSafe for SanitizerConfig
impl Send for SanitizerConfig
impl Sync for SanitizerConfig
impl Unpin for SanitizerConfig
impl UnsafeUnpin for SanitizerConfig
impl UnwindSafe for SanitizerConfig
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