pub enum InlineElement {
Text {
value: String,
},
Strong {
value: String,
},
Emphasis {
value: String,
},
Code {
value: String,
},
Link {
text: String,
url: String,
title: Option<String>,
},
Image {
alt: String,
src: String,
title: Option<String>,
},
Strikethrough {
value: String,
},
}Expand description
An inline element within a block.
These represent inline formatting and links within text content.
Variants§
Text
Plain text
Strong
Bold text (text or text)
Emphasis
Italic text (text or text)
Code
Inline code (code)
Link
A link text
Image
An inline image
Strikethrough
Strikethrough text (text)
Implementations§
Source§impl InlineElement
impl InlineElement
Sourcepub fn to_plain_text(&self) -> &str
pub fn to_plain_text(&self) -> &str
Extract plain text from this inline element.
Returns only the visible text content, stripping markdown syntax. For links, returns the link text (not the URL). For images, returns the alt text.
§Example
use turbovault_core::InlineElement;
let link = InlineElement::Link {
text: "Overview".to_string(),
url: "#overview".to_string(),
title: None,
};
assert_eq!(link.to_plain_text(), "Overview");Trait Implementations§
Source§impl Clone for InlineElement
impl Clone for InlineElement
Source§fn clone(&self) -> InlineElement
fn clone(&self) -> InlineElement
Returns a duplicate of the value. Read more
1.0.0 · 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 InlineElement
impl Debug for InlineElement
Source§impl<'de> Deserialize<'de> for InlineElement
impl<'de> Deserialize<'de> for InlineElement
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<InlineElement, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<InlineElement, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for InlineElement
impl PartialEq for InlineElement
Source§impl Serialize for InlineElement
impl Serialize for InlineElement
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for InlineElement
Auto Trait Implementations§
impl Freeze for InlineElement
impl RefUnwindSafe for InlineElement
impl Send for InlineElement
impl Sync for InlineElement
impl Unpin for InlineElement
impl UnwindSafe for InlineElement
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