A snippet is a file that is sort of like a miniature topic. You can insert and format text, tables, images, and whatever else can be included in a normal topic. A snippet can be inserted into one or more topics throughout your project, thus allowing you to reuse content that is maintained in one place. You can even insert them into other snippets, creating nested snippets. We’re not usually talking about single words or phrases; that’s what variables are for.
The major benefit of using snippets is that you only have to create your content once, rather than having to type the same information in each topic where you want to use it. If you need to modify the content of a snippet, you only need to change it in one place and the change is made automatically everywhere that the snippet is added.
Snippets are contained in their own files (using an .flsnp file extension). You can therefore share them with other authors or use them in other projects. If you insert a snippet that is stored outside of your project, the file is copied to your project. The traditional location to store a snippet in the Content Explorer is in the Resources\Snippets folder. However, you can store it anywhere in the Content Explorer that you like.
Let's say you are writing a manual about dogs. In one topic, you have created a colorful table with images that lists the top five breeds. Let's say you want to place that same table in seven other topics. You have a choice. (1) You can re-create that table manually in each of those topics. (2) You can copy the first table and paste it into the other topics. This is a better solution, but if you need to make changes to the table in the future, you'll need to do so in all eight topics. (3) You can create a snippet from the table and insert it into each of the other topics. This is the best solution because, if you need to make changes in the future, you only need to do so within the snippet and the changes are automatically reflected in all eight topics.
There are two types of snippets: text and block. This is determined by the way you insert the snippet.
- Text Snippets If you insert a snippet on a line where other content exists, it is inserted as a text snippet. Therefore, if you want to insert a snippet on a blank line and also type other text before or after it, you need to type the text first and then insert the snippet afterward. If you have a snippet containing multiple paragraphs and insert it within a line of text, the snippet becomes just one continuous line of text because it is a text snippet.
- Block Snippets If you insert a snippet on a blank line in a topic, it is inserted as a block snippet and takes up all of the room so that no other content can be added. Block snippets are best for multiple paragraphs, lists, and other large chunks of content.
When you create a text or block snippet, it displays surrounded by brackets (if you have markers turned on).
You can apply a condition tag to a snippet so that it is included in some targets but not in other targets.
You can also create snippet conditions. Snippet conditions are condition tags that you can apply to content within snippets. They are especially useful when the majority of the snippet content is identical everywhere the snippet is used, but there are some small differences in some places. This allows you to use one snippet for many purposes, rather than having to create multiple snippets to account for the small exceptions. Whereas regular conditions are included or excluded at the target level, snippet conditions are included or excluded at the snippet or topic level. See Using Snippet Conditions.
Flare recognizes when you are typing content that matches existing snippets in your project. This makes it a very fast and convenient way to single-source your content.
Let's say you work on a team of 15 writers and there are a series of snippets in all of your projects that begin with the same three words—For more information…
Perhaps each person knows to start typing those words in certain places. But what if a snippet already exists with the full content that the writer needs? Without knowing that, a person might spend time typing all of the content, and maybe even create a new snippet for future use. But if Auto Suggestion is enabled, as soon as a person types a certain number of characters, all matching snippets are shown in the Auto Suggestion popup. Therefore, the writer can quickly find and select the appropriate snippet.
Following are the main tasks involved with using snippets.
Add Snippets You can add a new snippet (without necessarily having any topic open). See Adding New Snippets.
Note: You can also import an existing snippet from outside your project.
- Create Snippets From Content If you have already added content in your topic and want to turn that content into a snippet, you can create a snippet out of that existing content using the Home ribbon or Format menu. See Creating New Snippets from Existing Content.
- Edit Snippets You cannot modify the snippet at its location in the topic. When you insert a snippet into the topic, the content is displayed, but it is held in a separate snippet file. In the topic the snippet marker is represented by brackets. To modify a snippet you need to open it by right-clicking on it and selecting Open Link, or you can open it from the Content Explorer. Then you can make changes to it in the XML Editor. See Editing Snippets.
Insert Snippets After you create or add snippets, you can insert them into any topic in your project. See Inserting Snippets.
Note: You can also create nested snippets (i.e., a snippet within a snippet). To do this, simply open a snippet and then insert another snippet into it.
- Opening Snippets You can open existing snippets to review them and make modifications to them. See Opening Snippets.
- Using Snippet Conditions Snippet conditions are condition tags that you can apply to content within snippets. See Using Snippet Conditions.
Warning: It is recommended that you avoid creating links to snippets.This is primarily due to the nature of snippets, which are designed to be inserted into multiple files. Let's say you have a heading style in a snippet and that snippet is then inserted into 12 different topics. In another topic, you might decide to create a cross-reference that points to the heading in that snippet. But which of those 12 topics is it supposed to point to in the output? There is no way for Flare to know this, so you could end up with some very undesirable results. For this reason, it's a good idea not to link to any content in a snippet.
Note: Although it is possible to open any Flare files in a third-party editor, it is recommended that you avoid editing these files in certain programs while Flare is running. For example, opening a stylesheet in Notepad is not an issue. But you might experience problems if you open a topic or snippet in Microsoft Word and edit it while Flare is running.