Snippets

<< Click to Display Table of Contents >>

Navigation:  Reference > Workspace, Toolbars and Dialogs > The Write Tab > Insert / Insert Object >

Snippets

This option inserts a topic from the current project, a style repository project or an external Help+Manual XML topic or snippet file in the current topic at the cursor position. You can insert snippets in two modes: Paste and Linked. Pasted snippets are just like normal pasted text from any other source. Linked snippets are dynamically linked to the source topics or files and will updated automatically when the sources are edited.

When you publish your project a copy of the linked snippets is inserted in the output.

See Re-using content with snippets for details on working with snippets.

The Insert Snippet Dialog From Topic

This dialog inserts topics from the current project as snippets. Just select the topic ID of the topic you want to embed from the list and click on OK to insert it.

DLG_Insert_EmbeddedTopic

Dialog options:

Select topic:

Select the topic ID of the topic you want to insert as a snippet.

Common options in all snippet dialog modes:

Preview

Click on the preview on the right to see a full-size preview of the snippet contents.

Copy & Paste

Pastes the contents of the snippet file at the cursor position. After this you can edit it normally, just like any other text. Pasted snippets are not linked to the source file.

Snippet is linked

Creates a link to the original topic. The contents of the snippet cannot be edited in the editor but they will update automatically when the original topic is changed.

Snippet begins a new paragraph

If this is selected the snippet begins and ends with a new paragraph (block mode). If you deselect it the snippet will be inserted in inline mode, which allows you to use snippets within paragraphs.

The Insert Snippet dialog From File and From Repository:

From file:

This option is for inserting snippets from external XML topic files. You can create these files from topics and from selected text in topics with File > Save Snippet in Project > Manage Topics.

From repository:

This option is only available in Help+Manual Professional. It displays the snippets stored in a style repository project linked to your current project. It works the same as inserting a snippet from a topic in the current project. See Working with Style Repositories for details on style repositories.

Dialog options:

Snippet file:

The snippet file you want to insert. This must be a valid Help+Manual XML topic file or snippet file. You can create snippet files from topics and selected text with File > Save Snippet in Project > Manage Topics.

Help+Manual Professional only:
If you are using Help+Manual Professional you can save your projects in the uncompressed XML format (.hmxp option). When you do this you can load any topic file from another project directly as a snippet.

Select Topic:

Select the topic ID of the topic file stored in the style repository.

Use project search path

Only relevant for external XML snippet files. Select this to add the path to the snippet file to your Project Search Path in Configuration > Common Properties in the Project Explorer. If you do not select this option the path to the snippet will be stored in the topic with the snippet and the link to the snippet will be dead if the snippet is ever moved.

It is a good idea to use this option and to keep your snippet files organized in easily-accessible directories. You can then move your snippets and Help+Manual will still be able to find them if you update the Project Search Path. This will make it easier to transport your entire project and to send out all the components of your project for translation if this ever becomes necessary.

See also:

Using embedded topics

Working with style repositories