MediaWiki Extensions â Adding VisualEditor, Scribunto, and More
In this tutorial, you'll install extensions on your MediaWiki wiki â plugins that add features. This is Lesson 8 of our project: Build Your Own Documentation Wiki.
What You'll Build Today
By the end of this lesson, your wiki will have:
- VisualEditor â a WYSIWYG editor like WordPress or Google Docs
- Scribunto â Lua scripting for advanced templates
- A Lua-based template that shows the current date
- Confirmation that all extensions are working
Your wiki goes from "basic but functional" to "feature-rich."
What Are Extensions?
Extensions are add-ons that add features to MediaWiki. Think of them like apps for your phone or plugins for WordPress. There are thousands of extensions for:
- Editing (VisualEditor, CodeEditor)
- Security (ConfirmEdit, AbuseFilter)
- Search (Elastica, CirrusSearch)
- Import/Export (XMLDump, DataTransfer)
- Multimedia (EmbedVideo, PDFEmbed)
- Social features (SocialProfile, WikiForum)
Step-by-Step: Install and Configure Extensions
Step 1: Understand the Extension Installation Process
Every extension follows the same three steps:
- Download the extension files into the
extensions/folder - Enable it by adding
wfLoadExtension('ExtensionName')to LocalSettings.php - Configure it (some extensions need additional settings)
That's it. Let's do this for three essential extensions.
Step 2: Install the VisualEditor Extension
VisualEditor lets users edit pages with a WYSIWYG interface â no wikitext required. It's perfect for beginners who are intimidated by wiki markup.
Download VisualEditor:
- Go to the
extensions/folder in your MediaWiki installation:
cd /opt/lampp/htdocs/mediawiki/extensions
- Download the extension:
wget https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL1_42-abcdef.tar.gz
tar -xvzf VisualEditor-*.tar.gz
If the URL above doesn't work (extension versions change), go to the MediaWiki Extension Distributor and find the latest VisualEditor for your MediaWiki version.
- VisualEditor also needs Parsoid, a service that converts wikitext to HTML and back. The easiest way is to use the bundled Parsoid with MediaWiki 1.42+:
cd /opt/lampp/htdocs/mediawiki
composer install
If composer is not installed, you can skip VisualEditor for now and come back to it later.
Enable VisualEditor:
Add to LocalSettings.php:
wfLoadExtension( 'VisualEditor' );
$wgDefaultUserOptions['visualeditor-enable'] = 1;
// Enable VisualEditor by default for all users
$wgHiddenPrefs[] = 'visualeditor-enable';
Test it: Log in to your wiki and edit a page. You should see two tabs: "Edit" (wikitext) and "Edit visual" (VisualEditor). Click "Edit visual" â you'll see a toolbar with formatting buttons, just like a word processor.
Step 3: Install the Scribunto Extension
Scribunto lets you write templates in Lua, a real programming language. This makes your templates far more powerful than wikitext alone.
Download Scribunto:
- Go to the
extensions/folder - Download Scribunto from the extension distributor (same site as VisualEditor)
- Extract it into
extensions/Scribunto/
Enable Scribunto:
Add to LocalSettings.php:
wfLoadExtension( 'Scribunto' );
Create a Lua template:
Create a page at Module:Hello (notice: Module, not Template):
local p = {}
function p.hello()
return "Hello from Lua! The current time is " .. os.date("%H:%M:%S")
end
function p.greeting(frame)
local name = frame.args[1] or "World"
return "Hello, " .. name .. "!"
end
return p
Now create a template that calls this module. Create Template:Hello:
{{#invoke:Hello|hello}}
And a template with a parameter. Create Template:Greeting:
{{#invoke:Hello|greeting|{{{1|World}}}}}
Test it:
Edit any page and add:
{{Hello}}
{{Greeting|MediaWiki Learner}}
Save and view. The first line shows the current time. The second says "Hello, MediaWiki Learner!"
This is just the beginning. Lua templates can format dates, calculate numbers, query categories, and much more. Scribunto opens up a world of possibilities that wikitext alone can't handle.
Step 4: Install Other Useful Extensions
Here are more extensions worth adding. Each follows the same three-step process.
Page Forms â Create forms for page creation (like a database interface):
wfLoadExtension( 'PageForms' );
After installing, users can create pages by filling out a form instead of writing wikitext. This is great for structured data like bug reports, employee records, or product listings.
EmbedVideo â Embed YouTube/Vimeo videos:
wfLoadExtension( 'EmbedVideo' );
Usage: {{#ev:youtube|VIDEO_ID}}
CodeEditor â Better wikitext editor with syntax highlighting:
wfLoadExtension( 'CodeEditor' );
This gives you a code editor with line numbers and colored syntax when editing templates and modules.
Step 5: Check Which Extensions Are Loaded
Go to Special:Version on your wiki. This page shows:
- MediaWiki version
- All installed extensions with their versions
- PHP and database versions
- Skin information
If an extension appears here, it's loaded correctly. If it doesn't, check that:
- The extension folder exists in
extensions/ - The
wfLoadExtension()line is correct in LocalSettings.php - There are no PHP error messages
What You Learned
- Extensions are installed in three steps: download, enable, configure
- VisualEditor provides a WYSIWYG editing interface
- Scribunto enables Lua scripting for advanced templates
Special:Versionshows all installed extensions- Extensions extend every part of MediaWiki
In the next lesson, you'll learn how to back up your wiki and maintain it over time.
Common Errors
| Error | Why It Happens | How to Fix |
|---|---|---|
| "The requested extension does not exist" | Wrong extension name in wfLoadExtension() |
Double-check the extension folder name. It must match exactly. Compare with the directory name in extensions/. |
| "Could not find the file .../extension.json" | Extension files are in the wrong folder | Make sure the extension folder is directly inside extensions/ with no subfolder. Path should be extensions/VisualEditor/extension.json. |
| VisualEditor shows "Error contacting the Parsoid server" | Parsoid is not running | Modern MediaWiki (1.42+) bundles Parsoid. Run composer install from the MediaWiki root directory. If that doesn't work, you need to run Parsoid as a separate service. |
| Scribunto shows "Lua error: ..." | A bug in the Lua code | Check the error message for the line number. Common mistakes: missing end, incorrect variable names, using os.date() without returning the string. |
| CAPTCHA not showing after installing ConfirmEdit | ConfirmEdit extension not loaded or wrong captcha class | Verify wfLoadExtension('ConfirmEdit') is in LocalSettings.php. Make sure the extension files exist in extensions/ConfirmEdit/. |
| White screen after enabling an extension | PHP version mismatch or missing dependencies | Check the MediaWiki error log (/opt/lampp/logs/php_error_log). Some extensions require specific PHP versions or other extensions. |
FAQ
How many extensions should I install?
Only what you need. Each extension adds complexity, maintenance burden, and potential security risks. Start with essentials (VisualEditor, Scribunto, ConfirmEdit) and add more as your wiki grows.
Do extensions survive a MediaWiki upgrade?
Most do, but you need to update them. After upgrading MediaWiki, go to Special:Version and check that all extensions show the correct version. If an extension shows "Unknown version" or an old version, download the updated version for your new MediaWiki release.
Can I write my own extension?
Yes. MediaWiki has a well-documented extension API. The simplest extension is a single PHP file with a hook function. Start with the MediaWiki Extension Writing Guide for examples.
What's the difference between an extension and a skin?
- Extensions add functionality (editing, search, security)
- Skins change appearance (colors, layout, fonts)
We'll cover skins in a separate lesson.
An extension broke my wiki. How do I recover?
Comment out the wfLoadExtension() line in LocalSettings.php. This disables the extension without removing its files. Your wiki will work normally again. Then investigate the error and re-enable once fixed.
What's Next
Your wiki is feature-rich with extensions. But all that work can disappear if you don't back it up.
Continue to Lesson 9: Backups & Maintenance â learn how to back up your wiki's database and files, perform upgrades, and keep everything running smoothly.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro