This plugin inserts a link to a non-existing page at the text cursor's current position. This is useful when you need to create a new cross-linked page but haven't figured out the name of it. It's based on, and works in conjunction with, the autoNew extension.

The plugin has been tested and verified for wikidPad versions:

  • 1.9rc04
  • 2.0beta03-beta04
import re

#, plugin for wikidPad.
# Published under the same license as wikidPad (GPL 2.1 or later):
# Feel free to improve the plugin.

# This plugin is based on the extension "".
# It inserts a link to a new non-existing page at the text cursor's current position.
# The link has the format of "New+next number"
# "" and this plugin can be used in conjunction with each other.
# Add the plugin to the directory user_extensions in wikidPad directory.
# Select it from the Plugins menu or press Ctrl-Shift-I to create a new link.

# Set your wikidPad version here as '1.9' or '2.0'.
wpversion = 'your wikidPad version'

WIKIDPAD_PLUGIN = (("MenuFunctions",1),)
def describeMenuItems(wiki):

    kb = wiki.getKeyBindings()
    return ((newLink, _(u"Insert new link") + u"\tShift-Ctrl-I" +
            kb.Plugin_new_link, _(u"Insert new link")),)

_testRE = re.compile(ur"^New[0-9]{6}$")

def newLink(wiki, evt):

    if wpversion < '2.0':
    	candidates = wiki.getWikiData().getWikiWordsStartingWith(u"New",

    	candidates = wiki.getWikiData().getWikiLinksStartingWith(u"New",
    candidates = filter(lambda w: _testRE.match(w), candidates)
    numbers = map(lambda w: int(w[3:]), candidates)

    if len(numbers) == 0:
        nextNumber = 1
        nextNumber = max(numbers) + 1

    editor = wiki.getActiveEditor()
    editor.AddText("[" + u"New%06i" % nextNumber + "]")
Last modified 9 years ago Last modified on Jun 12, 2009 6:22:59 AM