       runner.next()
     ]
   runner.push null, ->
-    # Called whenever the `short` tag is found to indicate that the URL needs
-    # shortened.  
-    # Replace the `short` tag with the unique placeholder so that it can be
-    # rendered again later with the short URL.
-    shortCallback = ->
-      shortCalled = yes
-      "{#{shortPlaceholder}}"
+    # Called whenever the `shorten` (or previously `short`) tag is found to
+    # indicate that a URL needs shortened.  
+    # Replace the tag with the unique placeholder so that it can be rendered
+    # again later with the short URL.
+    shortCallback = (text, render) ->
+      text = if text then render text else @url
+      url  = text.trim()
+      # If `url` doesn't appear to be a valid URL so just return the rendered
+      # `text`.
+      return text unless R_VALID_URL.test url
+      placeholder = key for own key, value of shortenMap when value is url
+      unless placeholder?
+        placeholder = utils.keyGen '', null, 's', no
+        shortenMap[placeholder] = url
+        # Sections are re-rendered so the context must have a property for the
+        # placeholder the replaces itself with itself so that it still when it
+        # comes to replacing with the shortened URL.
+        @[placeholder] = "{#{placeholder}}"
+      "{#{placeholder}}"
     # If the popup is currently displayed, hide the template list and show a
     # loading animation.
     if popup

  # Info requests are simple, just send some useful information back. Done!
  if request.type in ['info', 'version']
    return sendResponse? id: EXTENSION_ID, version: ext.version
  data             = null
  output           = null
  popup            = chrome.extension.getViews(type: 'popup')[0]
  popupItems       = if popup then $ '#item',    popup.document else $()
  popupLoader      = if popup then $ '#loadDiv', popup.document else $()
  shortCalled      = no
  shortPlaceholder = "short#{utils.random 1000, 99999}"
  tab              = null
  template         = null
  windowId         = null
  # Create a runner to manage this asynchronous mess.
  runner = new utils.Runner()
  runner.push chrome.windows, 'getCurrent', (win) ->

    key:      'PREDEFINED.00006'
    readOnly: yes
    shortcut: 'M'
    title:    i18n.get 'default_template_markdown'
    usage:    0
]
# Extension ID being used by Template.
