mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Trim mailto:
and tel:
from links
This commit is contained in:
parent
5e34c81a01
commit
1ca4ff69e2
@ -199,7 +199,7 @@ pub fn link(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> {
|
||||
let url = args.expect::<Str>("url")?;
|
||||
let body = args.find().unwrap_or_else(|| {
|
||||
let mut template = Template::new();
|
||||
template.text(&url);
|
||||
template.text(url.trim_start_matches("mailto:").trim_start_matches("tel:"));
|
||||
template
|
||||
});
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 9.1 KiB |
@ -7,6 +7,10 @@
|
||||
// With line break.
|
||||
This link appears #link("https://google.com/")[in the middle of] a paragraph.
|
||||
|
||||
// Prefix is trimmed.
|
||||
Contact #link("mailto:hi@typst.app") or call #link("tel:123") for more information.
|
||||
|
||||
---
|
||||
// Styled with underline and color.
|
||||
#let link(url, body) = link(url, font(fill: rgb("283663"), underline(body)))
|
||||
You could also make the #link("https://html5zombo.com/")[link look way more typical.]
|
||||
|
Loading…
x
Reference in New Issue
Block a user