pub struct AutoSlug { /* private fields */ }Expand description
Generates URL-safe slugs for headings and sets the id field.
Slug algorithm:
- Extract plain text from heading children
- Lowercase, replace non-alphanumeric runs with
-, trim- - Deduplicate by appending
-1,-2, etc.
§Example
use rdx_transform::{Pipeline, AutoSlug, parse};
let root = Pipeline::new().add(AutoSlug::new()).run("# Hello World\n");
// heading.id == Some("hello-world")Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AutoSlug
impl RefUnwindSafe for AutoSlug
impl Send for AutoSlug
impl Sync for AutoSlug
impl Unpin for AutoSlug
impl UnsafeUnpin for AutoSlug
impl UnwindSafe for AutoSlug
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