#[non_exhaustive]pub enum InlineMacro {
}Expand description
An inline macro - a functional element that produces inline content.
Unlike a struct with name/target/attributes fields, InlineMacro is an enum
where each variant represents a specific macro type with its own specialized fields.
§Variants Overview
| Variant | AsciiDoc Syntax | Description |
|---|---|---|
Link | link:url[text] | Explicit link with optional text |
Url | \https://... or link: | URL reference |
Mailto | mailto:addr[text] | Email link |
Autolink | <\https://...> | Auto-detected URL |
CrossReference | <<id>> or xref:id[] | Internal document reference |
Image | image:file.png[alt] | Inline image |
Icon | icon:name[] | Icon reference (font or image) |
Footnote | footnote:[text] | Footnote reference |
Keyboard | kbd:[Ctrl+C] | Keyboard shortcut |
Button | btn:[OK] | UI button label |
Menu | menu:File[Save] | Menu navigation path |
Pass | pass:[content] | Passthrough (no processing) |
Stem | stem:[formula] | Math notation |
IndexTerm | ((term)) or (((term))) | Index term (visible or hidden) |
§Example
fn extract_link_target(node: &InlineNode) -> Option<String> {
match node {
InlineNode::Macro(InlineMacro::Link(link)) => Some(link.target.to_string()),
InlineNode::Macro(InlineMacro::Url(url)) => Some(url.target.to_string()),
InlineNode::Macro(InlineMacro::CrossReference(xref)) => Some(xref.target.clone()),
_ => None,
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Footnote(Footnote)
Footnote reference: footnote:[content] or footnote:id[content]
Icon(Icon)
Icon macro: icon:name[attributes]
Image(Box<Image>)
Inline image: image:path[alt,width,height]
Keyboard(Keyboard)
Keyboard shortcut: kbd:[Ctrl+C]
Button(Button)
UI button: btn:[Label]
Menu(Menu)
Menu path: menu:TopLevel[Item > Subitem]
Url(Url)
URL with optional text: parsed from link: macro or bare URLs
Link(Link)
Explicit link macro: link:target[text]
Mailto(Mailto)
Email link: mailto:address[text]
Autolink(Autolink)
Auto-detected URL: <\https://example.com>
CrossReference(CrossReference)
Cross-reference: <<id,text>> or xref:id[text]
Pass(Pass)
Inline passthrough: pass:[content] - not serialized to ASG
Stem(Stem)
Inline math: stem:[formula] or latexmath:[...] / asciimath:[...]
IndexTerm(IndexTerm)
Index term: ((term)) (visible) or (((term))) (hidden)
Trait Implementations§
Source§impl Clone for InlineMacro
impl Clone for InlineMacro
Source§fn clone(&self) -> InlineMacro
fn clone(&self) -> InlineMacro
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more