This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

Using Stamp

1st January 2023 at 11:49am

Snippets are pre-configured snippets of text which can be inserted into the editor by clicking the stamp () button on the toolbar and then on the required item.

Snippets can either replace, or be added before and/or after, the selected text in the editor.

Create a snippet

Whilst editing a tiddler

  1. Click stamp () on the toolbar
  2. Click "Add your own" at the bottom of the menu
  3. Type the text for the snippet in the editor
  4. Enter the caption for the snippet menu item in the caption field
  5. Click the Confirm changes to this tiddler button

Manually

  1. Create a new tiddler by clicking the Create a new tiddler button in the sidebar
  2. Change the title for the tiddler (from e.g. New Tiddler 1). The tiddler title determines the menu item for the stamp if you do not set a caption field (see below).
    Tip
    Pro tip Set a title like $:/yourusername/snippets/My new stamp to 'file' your new tiddler away as a system tiddler which doesn't appear in the normal search results
  3. Add the tag $:/tags/TextEditor/Snippet by entering $:/tags/TextEditor/Snippet in the tag name tag box and clicking Add (or pressing the Enter key)
  4. Enter the snippet content (which you wish to appear in the editor when you click the stamp menu ) in the editor
  5. Create a field with the name caption and value set to the text for the snippet's stamp menu item:
    1. Enter caption in the Add new field field name box
    2. Enter the stamp menu item caption in the field value box

Re-ordering snippets

Your new snippet will appear at the bottom of the stamp menu by default. To adjust the order of snippets:

  1. Navigate to a snippet tiddler
  2. Click the tag pill
  3. Drag items up and down the menu of snippets

Adding a prefix and/or suffix to a selection Introduced in v5.1.20

By default, the stamp button replaces text you have selected in the editor (let's say selectedText)with your snippet (let's say $:/my/snippet).

If instead of replacing selected text, you wish the stamp button to add wikitext before and/or after the selection:

  1. Create a snippet tiddler (tagged $:/tags/TextEditor/Snippet, with caption field set to desired stamp menu item text) using either of the two methods above
  2. Create a new tiddler with either /prefix or /suffix appended to the end of the snippet tiddler's title, according to whether you wish the stamp to insert the snippet content before (/prefix) or after (/suffix) the text selected in the editor.
    • Do not tag the tiddler $:/tags/TextEditor/Snippet; the caption field is ignored
    • Set the tiddler text to the text you wish to be inserted before or after your selection
Example configuration for snippet2 with prefix+suffix
TiddlerTiddler contentTagcaption field
$:/snip/snippet2$:/tags/TextEditor/SnippetMy second stamp menu item
$:/snip/snippet2/prefixTextIWantPrependedToSelection
$:/snip/snippet2/suffixTextIWantAppendedToSelection