Live templates provide snippets for common AsciiDoc patterns. They guide authors to structure their documents.
Once the user types ad, a list of templates appears. Continue typing characters to restrict the list of the template names. A Tab expands the current entry.
Users can add their own live templates to avoid repetitive typing and to ensure consistency. Go tofor this configuration.
All live templates of this plugin except one will only be available when editing AsciiDoc content.
One live template is special: ad-tag-include
This template adds comments with the tag-syntax to your source file that mark snippets to be extracted by AsciiDoc include preprocessor macros later. Read more in the Asciidoctor user manual in section Select Portions of a Document to Include.
Example showing how snippets work
Given the following text file…
Other text // tag::tagname Some Snippet // end::tagname more text
… and an AsciiDoc source like the following …
Some text from another file: include::text.txt[tag=tagname]
… this produces the following output:
Some text from another file:
This live template works in two ways:
- Create an empty snippet
Type ad-tag-include when no text is selected.
This creates empty snippets with tag boundaries. The plugin places the cursor at the tag name. Once the user has changed the tag name and pressed Enter, the plugin places the cursor within the snippet, and the user can start typing the snippet’s text.
- Create a snippet from existing text
Selecting a text block, then choose Surround with… (Shortcut Ctrl+Alt+T on Linux/Windows or ⌘+⌥+T on macOS) and then choose ad-tag-include.
This creates the tag boundaries before and after the previously selected text. The plugin places the cursor at the tag name. Then the user types the tag name and presses Enter.
If a user doesn’t want to see the ad-tag-include live template when typing content in any other language, there are two options to disable it:
- Disable this live template completely
Go to menu.
Uncheck the checkbox to disable this live template.
- Choose specific languages for this live template
Go to menu.
Select the entry ad-tag-include.
Choose Change at the end of the line starting with Applicable in… (might need to make the dialog a little wider).
Select the file types where the live template should appear.