Inserting Snippets

After you create or add snippets, you can insert them into a content file (e.g., topic, snippet). You can do this by using user interface options, which let you search for a snippet, or you can simply drag an existing snippet from the Content Explorer or File List window pane.

How to Insert a Snippet—Insert Snippet Link Dialog

  1. Open the content file.
  2. Place your cursor where you want to insert the snippet.
  3. Do one of the following, depending on the part of the user interface you are using:
    • Ribbon Select Insert > Snippet.

    • Local Toolbar Click the face of the button.

      OR

      Click the down arrow next to , then select More Snippets.

    • Keyboard Shortcut Press CTRL+R.
    • Right-Click Right-click in the editor and select Insert > Snippet. This context menu option is available only when your cursor is located in certain places in the editor (e.g., not in a drop-down effect).

    The Insert Snippet Link dialog opens.

  4. Navigate to the snippet that you want to insert and select it. By using the buttons in the local toolbar, you can view all snippet files in a list, view files in their folder structure, and use other options. If you want to add one of your 20 most recently used snippets to the project, you can select a snippet from the Recently Used Snippets group. If you want to add one of your pinned—or favorite—snippets to the project, you can select a snippet from the Pinned Snippets group. You also can click The browse ellipsis button opens to more options. to find and select a snippet file outside of the project.

    Option

    Description

    Shows all of the files in the project in a list below. Click the button again to switch to a folder tree view. You can click the File, Type, or Path column headers to sort the list alphabetically by that column data.

    Click to show or hide folders where files are kept.

    Shows or hides the folders that the files are stored in.

    Click to show or hide files within a folder.

    Shows or hides the files. If you click this button when the Show Folders button Click to show or hide folders where files are kept. is selected, the area splits into two. The folder is shown on the left side, and the files and subfolders within it are shown on the right.

    Click to move up one folder level.

    If the Show Files button Click to show or hide files within a folder. is the only one selected, you can click this button to move up one folder level.

    Lets you filter the kinds of files shown below. Depending on the task you are performing, this field may already be populated with the most appropriate file type(s).

    Note If you select a snippet file outside the project, that file is then copied and placed inside the project. The image file is stored in the Resources\Snippets folder of the Content Explorer.

  5. Click OK. The snippet is inserted and is surrounded by brackets (if markers are turned on).

  6. Click Save the active file. to save your work.

How to Insert a Snippet—Drag-and-Drop

  1. Open the Content Explorer or File List window pane.

    If necessary, make sure you float and position the window pane or editor (see Customizing the Workspace) so that you can see both it and XML Editor at the same time.

  2. Click and drag the snippet from the Content Explorer or File List window pane to the location where you want it in the XML Editor and drop it.
  3. Click Save the active file. to save your work.

How to Insert a Snippet—Local Toolbar

  1. Open the content file.
  2. Place your cursor where you want to insert the snippet.
  3. In the local toolbar at the top of the XML Editor click the down arrow next to . This expands the Insert Snippet drop-down, where you can see your pinned snippets and the 20 most recently used snippets.

  4. Navigate to the snippet that you want to insert and select it.
  5. Click Save the active file. to save your work.

What’s Noteworthy?

Note If you need to insert a snippet that does not appear in the Pinned Snippets or Recently Used Snippets groups, you can select More Snippets to open the Insert Snippet Link dialog.

Note Snippets must appear in the Recently Used Snippets group before they can be pinned. If the snippet you want to pin does not appear in the Recently Used Snippets group, you can add it to a content file by dragging it from the Content Explorer or using the Insert Snippet Link dialog.

Note The Recently Used Snippets and Pinned Snippets groups show the relative path location of each snippet. Hover over any snippet to see its full file path.

Note You can expand or collapse the Recently Used Snippets and Pinned Snippets groups by clicking the arrows next to each group name.

Note If you have the snippet feature in Auto Suggestions enabled, you can quickly insert snippets into content files when you begin typing matching text. See Auto Suggestion and Inserting Auto Suggestions Into Content.

Note You can also import an existing snippet from outside your project. See Importing Snippets.

Note If you want to change how snippets look when they're inserted in the XML Editor, you can change the MadCap|snippetBlock or MadCap|snippetText styles (for block and text snippets, respectively) in the Stylesheet Editor. This does not affect the output. See Editing Styles in a Regular Stylesheet.