Gamepedia Help Wiki
Advertisement

SublimeText 3 is a text editor that supports various language markups and has a number of plugins that can extend functionality. It is an alternative to Notepad++, and on its own can be a useful program to install and use if you don't already use Notepad++. This article will discuss one specific plugin called Mediawiker, which allows you to edit the wiki directly from your text editor without interacting with the browser interface at all.

Benefits of Using Mediawiker

There are a number of reasons this is desirable:

  • Syntax highlighting is significantly nicer than the WikEd gadget or other in-browser alternatives
  • Regardless of the skin of your wiki, you can work in night mode
  • The tab character works as desired
  • You can take advantage of other plugins such as BracketHighlighter
  • SublimeText saves your current session, so there's much less chance to lose your work in case of your computer crashing
  • The editing area takes up the entirety of its window, so you have more space to work with; you can also use two-column mode

Some editors already prefer to edit locally and then copy-paste code to the wiki; this plugin lets you remove that step of copy-pasting and save directly to the wiki.

Installation

To download SublimeText, go here and download the version you want. You will then need to install Package Control, which is SublimeText's package manager. Follow the instructions here. (Because the installation code that you copy-paste changes per version, it will not be rehosted here, but the instructions they provide are very straightforward.) With package control installed, you can now install Mediawiker. In SublimeText, navigate Preferences -> Package Control and then select Install Package. Start typing "Mediawiker" and select it when it shows up.

Configuration

SublimeText does all of its configuration through editable config files, rather than GUIs. This makes it super easy to allow nearly anything to be customized, but it also means that there's a bit of a learning curve. Go to Preferences -> Package Settings -> Mediawiker -> Settings. A new window of SublimeText should open with 2 columns. Add the following to your user settings (the right side), replacing fields as needed:

		"Leaguepedia":
		{
			"authorization_type": "login",
			"cookies_browser": "chrome",
			"domain": "",
			"host": "lol.gamepedia.com",
			"http_auth_login": "",
			"http_auth_password": "",
			"https": true,
			"is_ssl_cert_verify": true,
			"is_wikia": false,
			"oauth_access_secret": "",
			"oauth_access_token": "",
			"oauth_consumer_secret": "",
			"oauth_consumer_token": "",
			"pagepath": "/",
			"password": "<put your bot password here>",
			"path": "/",
			"preview_custom_head":
			[
			],
			"proxy_host": "",
			"retry_timeout": 30,
			"show_red_links": false,
			"use_http_auth": false,
			"username": "RheingoldRiver@ST3"
		}

If you don't have a bot password yet, follow the instructions here to get one. Because Mediawiker doesn't do any automated tasks for you, you can be liberal about giving this password permissions, but of course as a good practice don't give it anything you definitely won't need.

If you want, you can also edit hotkeys by opening the hotkey settings from the same path as the general settings file. You will probably want mediawiker_open_page and mediawiker_edit_panel to be easily accessible. If you switch wikis a lot, you will want to use mediawiker_set_active_site a lot too.

Setting Default Text

This is not actually supported by the plugin, but if you go to AppData -> Roaming -> SublimeText 3 -> Packages -> Mediawiker you can open mediawikier.py, search for text =. You will see this block of code:

        text = utils.api.page_get_text(page, self.section)
        page_namespace = utils.api.page_attr(page, 'namespace')

        if not text:
            utils.status_message('Page [[%s]] is not exists. You can create new..' % (self.title))
            text = '<!-- New wiki page: Remove this with text of the new page -->'

Replace <!-- New wiki page: Remove this with text of the new page --> with whatever default text you want. This may be particularly nice if you are creating a lot of modules.

Recommended Additional Plugins

Use the package manager to install all of these.

Advertisement