Link Search Menu Expand Document

iOS Share and Quick Capture

Table of Contents

  1. iOS Share and Quick Capture
  2. Web Capture Template

iOS Share and Quick Capture

Drafts offers two options that are available to capture text through the iOS system share sheet in other apps.

  • Share extension: Appears as an icon in the iOS share sheet, and when selected opens a Drafts window with options to edit/adjust the text, assign tags/flags, and even append/prepend to existing drafts when capturing text.
  • Drafts Quick Capture extension: Captures the shared text as a new draft in your inbox without further interaction.

extensions/share

Web Capture Template

In general, Drafts will capture any text provided to the share extension by the host app. In the case of Safari, when using the share button in the toolbar, share extensions can also access information about the web page currently being shared.

To customize the presentation of the data shared from Safari, a “Web Capture Template” is available, which can be edited in Settings > Extensions > Share & Action on iOS, or Preferences > Extensions on Mac. This allows you to configure whether and in what format to include the title of the page, source URL, and even text selections, if present.

Web Capture Templates can be use standard Drafts template syntax, or Mustache template syntax. The following special tags are available:

  • Drafts Templates
    • [[url]]: The full URL of the current page.
    • [[title]]: The page <title> value for the page.
    • [[selection]]: The current text selection, if present, in plain text format.
    • [[selection_html]]: The current HTML selection, if present, in raw HTML format.
    • [[selection_markdown]]: The current HTML selection, if present, converted to Markdown.
    • [[date]]: The current date. Supports strftime format strings, like [[date|%Y-%m-%d]]
  • Mustache Templates
    • {{url}}: The full URL of the current page.
    • {{title}}: The page <title> value for the page.
    • {{selection}}: The current text selection, if present, in plain text format.
    • {{selection_lines}}: The current text selection, if present, as an array of strings one per line.
    • {{selection_html}}: The current HTML selection, if present, in raw HTML format.
    • {{selection_markdown}}: The current HTML selection, if present, converted to Markdown.
    • {{selection_markdown_lines}}: The current HTML selection, if present, converted to Markdown, and provided as an array of strings one per line.
    • {{date}}: The current date.

The primary advantage of using Mustache templates is the availability of conditional sections, so that a formatting section can be included if, and only if, a text selection is present. Restore the default Mustache template in preferences for an example use.


© 2012-2024 by Agile Tortoise, Inc.
Drafts is a registered Trademark of Agile Tortoise, Inc.
Privacy | Terms

Mastodon