#[non_exhaustive]pub enum InlineMacro<'a> {
Show 14 variants
Footnote(Footnote<'a>),
Icon(Icon<'a>),
Image(Box<Image<'a>>),
Keyboard(Keyboard<'a>),
Button(Button<'a>),
Menu(Menu<'a>),
Url(Url<'a>),
Link(Link<'a>),
Mailto(Mailto<'a>),
Autolink(Autolink<'a>),
CrossReference(CrossReference<'a>),
Pass(Pass<'a>),
Stem(Stem<'a>),
IndexTerm(IndexTerm<'a>),
}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.to_string()),
_ => None,
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Footnote(Footnote<'a>)
Footnote reference: footnote:[content] or footnote:id[content]
Icon(Icon<'a>)
Icon macro: icon:name[attributes]
Image(Box<Image<'a>>)
Inline image: image:path[alt,width,height]
Keyboard(Keyboard<'a>)
Keyboard shortcut: kbd:[Ctrl+C]
Button(Button<'a>)
UI button: btn:[Label]
Menu(Menu<'a>)
Menu path: menu:TopLevel[Item > Subitem]
Url(Url<'a>)
URL with optional text: parsed from link: macro or bare URLs
Link(Link<'a>)
Explicit link macro: link:target[text]
Mailto(Mailto<'a>)
Email link: mailto:address[text]
Autolink(Autolink<'a>)
Auto-detected URL: <\https://example.com>
CrossReference(CrossReference<'a>)
Cross-reference: <<id,text>> or xref:id[text]
Pass(Pass<'a>)
Inline passthrough: pass:[content] - not serialized to ASG
Stem(Stem<'a>)
Inline math: stem:[formula] or latexmath:[...] / asciimath:[...]
IndexTerm(IndexTerm<'a>)
Index term: ((term)) (visible) or (((term))) (hidden)
Implementations§
Trait Implementations§
Source§impl<'a> Clone for InlineMacro<'a>
impl<'a> Clone for InlineMacro<'a>
Source§fn clone(&self) -> InlineMacro<'a>
fn clone(&self) -> InlineMacro<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more