Wikitext-Extension-Gadget

June 23, 2026 ยท View on GitHub

GitHub: wikitext gadget Toolhub: wikitext gadget

Deploy and Release Gadget GitHub Actions CodeQL

Twitter: @rwfholme Patreon Donate

A Mediawiki Gadget for Wikitext Extension based on MediaWiki. To allow users to directly open VSCode in the browser to edit wiki pages. Open VSCode in the browser to edit wiki pages

Usage

For ordinary users

Caution

Due to the Content-Security-Policy implemented by Wikimedia, sites within the Wikimedia family of projects may refuse to execute user scripts from external sources, including this one. If you encounter this issue, please try replacing the script mentioned below with this line:

mw.loader.load("https://meta.wikimedia.org/w/index.php?title=User:Rowe_Wilson_Frederisk_Holme/Wikitext-Extension-Gadget/index-vscode-insiders.js&action=raw&ctype=text/javascript");

Please refer to the information below to replace the index-vscode-insiders.js part with the specific version you require.

First make sure that your VSCode has installed the Wikitext Extension for VSCode v3.4.0 or upper. Then you only need to log in to your site, open the User Preferences, Appearance, and add a new line of code for Custom JavaScript:

  • For VSCode user:

    mw.loader.load("https://github.com/Frederisk/Wikitext-Extension-Gadget/releases/latest/download/index-vscode.js");
    
  • For VSCode Insiders user:

    mw.loader.load("https://github.com/Frederisk/Wikitext-Extension-Gadget/releases/latest/download/index-vscode-insiders.js");
    
  • For VSCodium user:

    mw.loader.load("https://github.com/Frederisk/Wikitext-Extension-Gadget/releases/latest/download/index-vscodium.js");
    

In addition, if your wiki is a private site, or some pages require high permissions to access, you can use the version with the RemoteBot option disabled. At this time, when this gadget tries to invoke the VSCode editor, it will ask Wikitext extension to open the page with the account information it has logged in.

  • For VSCode user:

    mw.loader.load("https://github.com/Frederisk/Wikitext-Extension-Gadget/releases/latest/download/index-vscode-local.js");
    
  • For VSCode Insiders user:

    mw.loader.load("https://github.com/Frederisk/Wikitext-Extension-Gadget/releases/latest/download/index-vscode-insiders-local.js");
    
  • For VSCodium user:

    mw.loader.load("https://github.com/Frederisk/Wikitext-Extension-Gadget/releases/latest/download/index-vscodium-local.js");
    

For users who have customized API path

You may need to download the release or clone the repository, adjust some variables in the source code and copy the generated code to your account's User Preferences, Appearance in your site. The gadget built in this way cannot get the newest update. It's recommended to watch this repository to keep the function up-to-date.

There are two variables you should notice:

  • The apiPath should be consistent with the Entry point URLs: api.php in the website page Special:Version.

    APIPath: window.mw.util.wikiScript('api');
    
  • The scheme should be filled in the VSCode release version you are using. vscode or vscode-insiders.

    const scheme: string | undefined = 'vscode-insiders';
    

For codespace or code-server user

The gadget does not yet provide support for such editor.

Development

building

npm install -g yarn # install yarn
yarn # install node modules
yarn run compile # compile