Gamepedia Help Wiki
No edit summary
(45 intermediate revisions by 6 users not shown)
Line 1: Line 1:
'''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.
+
'''SublimeText''' 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.
  +
{{tocright}}
== Benefits of Using Mediawiker ==
+
== Benefits of using Mediawiker ==
 
There are a number of reasons this is desirable:
 
There are a number of reasons this is desirable:
 
* Syntax highlighting is significantly nicer than the WikEd gadget or other in-browser alternatives
 
* Syntax highlighting is significantly nicer than the WikEd gadget or other in-browser alternatives
Line 8: Line 9:
 
* SublimeText saves your current session, so there's much less chance to lose your work in case of your computer crashing
 
* 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
 
* 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
  +
* Easy built-in regular expression find-replace support without needing additional browser add-ons
   
 
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.
 
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.
Line 13: Line 15:
 
SublimeText Mediawiker example.png|Two wikipages with different syntax highlighting
 
SublimeText Mediawiker example.png|Two wikipages with different syntax highlighting
 
</gallery>
 
</gallery>
  +
 
== Installation ==
 
== Installation ==
  +
For both installation methods the following step is required.
To download SublimeText, go [https://www.sublimetext.com/3 here] and download the version you want. You will then need to install Package Control, which is SublimeText's package manager. Follow the instructions [https://packagecontrol.io/installation 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.
 
  +
# To download SublimeText, go [https://www.sublimetext.com/3 here] and download the version you want.
  +
  +
=== Default installation ===
  +
('''Recommended unless Package Control is offline''')
 
# You will then need to install Package Control, which is SublimeText's package manager. Follow the instructions [https://packagecontrol.io/installation 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 &rarr; Package Control and then select Install Package. Start typing "Mediawiker" and select it when it shows up.
  +
  +
=== Alternative installation ===
  +
# You can download the Mediawiker directly from github.com at: [https://github.com/tosher/Mediawiker/releases Download Overview]
  +
# Select the current release and download the source code (zip for Windows, or tar.gz for UNIX based systems).
  +
# Extract the content. It will generate you a folder called Mediawiker-RELEASENUMBER. Rename the folder to Mediawiker.
  +
# Preferences &rarr; Browse Packages in Sublime. It will open your package folder. Now move the folder Mediawiker inside your package folder.
  +
 
<gallery>
 
<gallery>
 
SublimeText Package Control.png|Package Control
 
SublimeText Package Control.png|Package Control
  +
Download mediawiker github.jpg|Download from GitHub
 
</gallery>
 
</gallery>
  +
 
== Configuration ==
 
== Configuration ==
  +
{{Message|SublimeText configuration views consist of two files side by side. The left one is owned by the software. Do not edit this one! Any changes you make to it can be overwritten at any time when PackageControl updates! The right one is owned by you, the user, and you can make all your changes here.}}
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:
+
SublimeText does all of its configuration through editable config files, rather than GUIs. Go to Preferences &rarr; Package Settings &rarr; Mediawiker &rarr; 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. Save the file once you are done.
<pre style="display:inline-block"> "Leaguepedia":
 
  +
<syntaxhighlight lang="json">{
  +
"site":
  +
{ "Leaguepedia":
 
{
 
{
  +
"authorization_type": "login",
+
"authorization_type": "login",
"cookies_browser": "chrome",
 
 
"host": "lol.gamepedia.com",
"domain": "",
 
 
"path": "/",
"host": "lol.gamepedia.com",
 
 
"pagepath": "/",
"http_auth_login": "",
 
  +
"username": "<your username>@<your bot username>",
"http_auth_password": "",
 
 
"password": "<put your bot password here>",
"https": true,
 
 
"domain": "",
"is_ssl_cert_verify": true,
 
 
"https": true,
"is_wikia": false,
 
 
"is_ssl_cert_verify": true,
"oauth_access_secret": "",
 
 
"proxy_host": "",
"oauth_access_token": "",
 
  +
"use_http_auth": false,
"oauth_consumer_secret": "",
 
 
"http_auth_login": "",
"oauth_consumer_token": "",
 
 
"http_auth_password": "",
"pagepath": "/",
 
 
"oauth_access_secret": "",
"password": "<put your bot password here>",
 
 
"oauth_access_token": "",
"path": "/",
 
 
"oauth_consumer_secret": "",
"preview_custom_head":
 
 
"oauth_consumer_token": "",
[
 
 
"cookies_browser": "chrome",
],
 
 
"preview_custom_head": [],
"proxy_host": "",
 
"retry_timeout": 30,
+
"retry_timeout": 30,
"show_red_links": false,
+
"is_wikia": false,
"use_http_auth": false,
+
"show_red_links": false,
  +
"preview_sandbox": ""
"username": "RheingoldRiver@ST3"
 
}</pre>
+
}
  +
}
If you don't have a bot password yet, follow the instructions [[Logging in to third-party tools|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.
 
  +
}</syntaxhighlight>
   
 
If you don't have a bot password yet, follow the instructions about [[Logging in to third-party tools|getting a bot password]]. 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 <code>mediawiker_open_page</code> and <code>mediawiker_edit_panel</code> to be easily accessible. If you switch wikis a lot, you will want to use <code>mediawiker_set_active_site</code> a lot too.
 
=== Setting Default Text ===
+
=== Optional: Set key bindings ===
 
If you want, you can also edit key bindings (aka hotkeys) by opening the key bindings settings from the same path as the general settings file. You will probably want <code>mediawiker_open_page</code> and <code>mediawiker_edit_panel</code> to be easily accessible. If you switch wikis a lot, you will want to use <code>mediawiker_set_active_site</code> a lot too.
This is not actually supported by the plugin, but if you go to AppData -> Roaming -> SublimeText 3 -> Packages -> Mediawiker you can open <code>mediawikier.py</code>, search for <code>text =</code>. You will see this block of code:
 
<pre style="display:inline-block"> text = utils.api.page_get_text(page, self.section)
 
page_namespace = utils.api.page_attr(page, 'namespace')
 
   
  +
Here's an example set of custom key bindings that you could put in the user side of the key-bindings settings view:
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 -->'</pre>
 
Replace <code><nowiki><!-- New wiki page: Remove this with text of the new page --></nowiki></code> with whatever default text you want. This may be particularly nice if you are creating a lot of modules.
 
   
  +
<syntaxhighlight lang="json">
== Recommended Additional Plugins ==
 
  +
[
  +
{ "keys": ["alt+f9"], "command": "mediawiker_set_active_site" },
  +
{ "keys": ["alt+f11"], "command": "mediawiker_open_page" },
  +
{ "keys": ["alt+f12"], "command": "mediawiker_edit_panel" }
  +
]
  +
</syntaxhighlight>
  +
  +
== Opening pages ==
  +
The following actions are done through the Command Palette, which you can access via Ctrl+Shift+P (or Cmd+Shift+P on Mac). You can see the current hotkey, if one is available, in the right-hand column of the palette.
  +
  +
# Set up your active wiki with <code>Mediawiker: Select wiki</code>. Then select a wiki from the dropdown provided and press enter.
  +
#* No wikis showing up here? Did you remember to save your config file after editing?
  +
#* Did you edit the USER file (the one on the right side - as opposed to the default one)?
  +
# Open a page for the first time with <code>Mediawiker: Open page</code>. Then type the full name of the page (including namespace if applicable) into the field provided and press enter.
  +
# Reopen a recent page with <code>Mediawiker: Pages history</code>. Then select a page and press enter.
  +
 
== Recommended additional plugins ==
 
Use the package manager to install all of these.
 
Use the package manager to install all of these.
* [https://packagecontrol.io/packages/LuaExtended LuaExtended], if you are coding modules
 
 
* [http://facelessuser.github.io/BracketHighlighter/ BracketHighlighter]
 
* [http://facelessuser.github.io/BracketHighlighter/ BracketHighlighter]
 
* [https://github.com/bobef/ColorSchemeEditor ColorSchemeEditor], if you like to customize your styles. This will also require the following two plugins:
 
* [https://github.com/bobef/ColorSchemeEditor ColorSchemeEditor], if you like to customize your styles. This will also require the following two plugins:
 
** [https://packagecontrol.io/packages/PackageResourceViewer PackageResourceViewer]
 
** [https://packagecontrol.io/packages/PackageResourceViewer PackageResourceViewer]
 
** [http://weslly.github.io/ColorPicker/ Sublime ColorPicker]
 
** [http://weslly.github.io/ColorPicker/ Sublime ColorPicker]
  +
* [https://packagecontrol.io/packages/Schemr Schemr], for easy navigation between color schemes you have installed. Pro tip: Filter the list by typing <code>light</code> or <code>dark</code> into the palette
  +
  +
== External links ==
  +
* [https://github.com/tosher/Mediawiker Mediawiker on GitHub]
  +
  +
[[Category:Guides]]
  +
[[Category:Third-party tools]]
  +
  +
== See also ==
  +
* [[Visual Studio Code]]
  +
  +
[[tr:SublimeText 3 Mediawiker]]

Revision as of 02:46, 25 July 2021

SublimeText 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
  • Easy built-in regular expression find-replace support without needing additional browser add-ons

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

For both installation methods the following step is required.

  1. To download SublimeText, go here and download the version you want.

Default installation

(Recommended unless Package Control is offline)

  1. 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.)
  2. 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.

Alternative installation

  1. You can download the Mediawiker directly from github.com at: Download Overview
  2. Select the current release and download the source code (zip for Windows, or tar.gz for UNIX based systems).
  3. Extract the content. It will generate you a folder called Mediawiker-RELEASENUMBER. Rename the folder to Mediawiker.
  4. Preferences → Browse Packages in Sublime. It will open your package folder. Now move the folder Mediawiker inside your package folder.

Configuration

WARNING:
GP Nova SublimeText configuration views consist of two files side by side. The left one is owned by the software. Do not edit this one! Any changes you make to it can be overwritten at any time when PackageControl updates! The right one is owned by you, the user, and you can make all your changes here.

SublimeText does all of its configuration through editable config files, rather than GUIs. 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. Save the file once you are done.

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

If you don't have a bot password yet, follow the instructions about getting a bot password. 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.

Optional: Set key bindings

If you want, you can also edit key bindings (aka hotkeys) by opening the key bindings 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.

Here's an example set of custom key bindings that you could put in the user side of the key-bindings settings view:

[
	{ "keys": ["alt+f9"], "command": "mediawiker_set_active_site" },
	{ "keys": ["alt+f11"], "command": "mediawiker_open_page" },
	{ "keys": ["alt+f12"], "command": "mediawiker_edit_panel" }
]

Opening pages

The following actions are done through the Command Palette, which you can access via Ctrl+Shift+P (or Cmd+Shift+P on Mac). You can see the current hotkey, if one is available, in the right-hand column of the palette.

  1. Set up your active wiki with Mediawiker: Select wiki. Then select a wiki from the dropdown provided and press enter.
    • No wikis showing up here? Did you remember to save your config file after editing?
    • Did you edit the USER file (the one on the right side - as opposed to the default one)?
  2. Open a page for the first time with Mediawiker: Open page. Then type the full name of the page (including namespace if applicable) into the field provided and press enter.
  3. Reopen a recent page with Mediawiker: Pages history. Then select a page and press enter.

Recommended additional plugins

Use the package manager to install all of these.

External links

See also