pub struct Autolink {
pub meta: NodeMeta,
pub form: AutolinkForm,
pub text: String,
}Expand description
An autolink: <https://example.com>, <a@b.c>, or a GFM literal
autolink, a bare https://…, www.…, or email address. The text as
written is the node’s one fact; Autolink::destination derives the link
target from it.
Fields§
§meta: NodeMetaNode metadata (source span). An angle-bracket autolink’s span covers its brackets.
form: AutolinkFormWhich autolink syntax the text is written in.
text: StringThe URL or address as written, without an angle-bracket autolink’s brackets.
Implementations§
Source§impl Autolink
impl Autolink
Sourcepub fn new(form: AutolinkForm, text: impl Into<String>) -> Self
pub fn new(form: AutolinkForm, text: impl Into<String>) -> Self
An autolink of form whose text is text.
Sourcepub fn destination(&self) -> Option<String>
pub fn destination(&self) -> Option<String>
The link target the text writes, or None when the text is not
exactly one autolink of its form. An angle-bracket URI links to itself
and an email address to it after mailto:; a literal www. domain
links to it after http://, a literal email address to it after
mailto:, and any other literal autolink to itself. A valid document
holds only autolinks with a destination.