asciidoctor / asciidoctor.org

:globe_with_meridians: Asciidoctor project site. Composed in AsciiDoc. Baked with Awestruct.
https://asciidoctor.org
Other
323 stars 805 forks source link

Improve `mailto` links documentation #846

Closed abelsromero closed 3 years ago

abelsromero commented 5 years ago

I could not find a clear reference in the user manual about how to create a mailto link with parameters, for example the subject. However, some pieces of the user manual seem to indicate this is possible, even if in a confusing way (at least to me). I tried different things and setting linkattrs but could not find how to do it, at the end I used mailto:info@domain.org[info,subject="sponsor%20plan"].

The confusing part to me is in https://raw.githubusercontent.com/asciidoctor/asciidoctor.org/master/docs/_includes/url.adoc:

TIP: Links with attributes (including the subject and body segments on mailto links) are a feature unique to Asciidoctor.
When they're enabled, you must surround the link text in double quotes if it contains a comma.

This mentions the option to set subject and body sections but the attributes summary table at the end of the section (https://asciidoctor.org/docs/user-manual/#summary) there's no mention of it. Also, the second line seems to be a leftover from when linkattrs was require (< 1.5.7).

mojavelinux commented 5 years ago

I can update the docs to make this clearer. FYI, here's how you add a subject and body:

mailto:info@domain.org[linked text,subject,body]

If you want the linked text to be the email address, just exclude it:

mailto:info@domain.org[,subject,body]

If you only want a subject, exclude the body:

mailto:info@domain.org[,subject]

linkattrs have never applied to the mailto macro.

The mailto prefix is required in order to have attributes (the text in brackets).

rockyallen commented 5 years ago

Could it go in a new subsection immediately after URLs? Email is not obviously related to URLs, mailto is not a uri-scheme, and mailto: is not affected by hide-uri-scheme as suggested by the current placement.

mojavelinux commented 3 years ago

All this information is now covered on a page dedicated to the mailto macro. See https://docs.asciidoctor.org/asciidoc/latest/macros/mailto-macro/