pub struct Hyperlinker { /* private fields */ }Expand description
Recognises linkable spans in text and builds their URLs.
Implementations§
Source§impl Hyperlinker
impl Hyperlinker
Sourcepub fn new() -> Self
pub fn new() -> Self
Link URLs and paths; references need repository.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Whether this linker adds links at all.
Sourcepub fn paths(self, paths: bool) -> Self
pub fn paths(self, paths: bool) -> Self
Link file paths and path:line:column locations (default on).
Sourcepub fn editor(self, template: impl Into<String>) -> Self
pub fn editor(self, template: impl Into<String>) -> Self
Link files through an editor URL template instead of file://, for
example vscode://file{path}:{line}:{column}. {path} is absolute and
already starts with /, so the template has no slash of its own before
it. {line} and {column} default to 1 when a location has none.
Sourcepub fn repository(self, url: impl Into<String>) -> Self
pub fn repository(self, url: impl Into<String>) -> Self
The repository web URL (https://github.com/owner/repo) that #123
references link into. owner/repo#123 links into that repository on
the same host.
Sourcepub fn file_url(
&self,
path: &str,
line: Option<usize>,
column: Option<usize>,
) -> Option<String>
pub fn file_url( &self, path: &str, line: Option<usize>, column: Option<usize>, ) -> Option<String>
The URL for a file location, or None when linking is off.
Sourcepub fn reference_url(&self, repo: Option<&str>, number: u64) -> Option<String>
pub fn reference_url(&self, repo: Option<&str>, number: u64) -> Option<String>
The URL for issue or pull request number, in repo (owner/name)
or the configured repository.