The Snippet tool in Write > Insert Object enables you to insert the contents of another topic, a Help+Manual XML file, an HTML file, a Markdown file or PDF pages at the cursor position. This feature makes it possible to build up a library of formatted content blocks that you can reuse in multiple projects. When you link snippets instead of pasting them you can also include files that are frequently changed, so that the current version is always included when you publish your project.
If you send your project for translation remember to include any linked external snippet files you have referenced, otherwise the translator won't see them! |
Help+Manual topics, topic files and XML files
You can insert topics and topic files from the current project, from other Help+Manual projects (there are some restrictions in the Basic version of H+M) and directly from Help+Manual XML files. This also includes formatted text blocks saved as XML snippet files (see below for details).
HTML files and Markdown files
You can also insert HTML and Markdown files directly as snippets. They are converted automatically to Help+Manual XML and then to the output format. This means that unlike the #MERGE tool for inserting HTML files, both HTML and Markdown snippets can be used in all output formats, not just HTML. Images referenced in HTML and Markdown will also be inserted and exported in all output formats, provided they are accessible.
Markdown snippets can slow down export
Note that processing Markdown files on publishing may take a while because of the extensive conversion operations necessary. So if you have a lot of them publishing your project will take longer.
How images in HTML and Markdown files are handled
When an image file reference is found in an HTML or Markdown file Help+Manual will first look for it in the regular project search path folders. If a matching file is found there, that will be used. If not, it will import the file from the relative link in the HTML or Markdown file, if this is possible.
Snippet insertion modes: Copy and Link
You can insert snippets in two different modes: Copy and Link. Copy mode is like normal Copy & Paste. It pastes the contents of the topic or file at the cursor position and you can then edit it. Link mode creates a live link to the snippet file. To edit the snippet you must then edit the original topic or file, but then it updates automatically in all the places where you have inserted it, even if you are using it in multiple projects.
Snippet storage locations
Rather than using snippets from many locations it is better to store all your snippet files in a common location, for example in a folder inside your project folder. Then add this folder to your project search path. This will make them easier to manage, particularly if you ever need to move your project or have it translated. Alternatively, you can also store them in a Style Repository or their own project. See further below for details on this.
See also:
Multiple TOC entries for one topic