Wikipedia:Text editor support
From Free net encyclopedia
It is often convenient to edit Wikipedia articles using a full-fledged text editor, instead of the text area of a web browser. Text editors provide facilities that are very useful for writing articles (especially long articles), such as spell checking, search and replace, macros, and syntax highlighting. This article contains pointers for adapting several text editors to writing Wikipedia articles.
Contents |
How to open articles in your text editor
Mozilla and Mozilla Firefox
If you are using the Mozilla web browser, it is possible to configure an external editor for editing wikipedia articles without copying and pasting them from the browser's text area. To achieve that, you need to download and install the MozEx extension and follow a quick MozEx tutorial. However, first note two important caveats:
- Currently, the official MozEx package (at http://mozex.mozdev.org/) does not support editing UTF-8-encoded documents. This is particularly problematic since all Wikipedia articles are encoded in UTF-8 by default. An unofficial version of MozEx which supports UTF-8 is available.
- Currently, the official MozEx package (at http://mozex.mozdev.org/) does not install properly on Mozilla Firefox 1.0. However, an unofficial repackaged version of MozEx for Firefox is available.
You can try using ViewSourceWith which provides similar functionality for the later versions of Firefox.
Other useful extensions are the external editor and the Wikipedia extension for Firefox. The latter makes editing Wikipedia pages easier by adding a toolbar to your browser and by providing new menu items in the context menu (right mouse key).
External editor feature starting with MediaWiki Version 1.5
See here: http://meta.wikimedia.org/wiki/Help:External_editors
Textbrowsers
The text-only browser elinks also provides a function to edit Textarea. The Key combination Ctrl-T calls an external Editor, e.g. vim. This allows also to use syntax highlighting, edit functions, spelling corrections and saving local copies. Another text browser, w3m, opens an external editor for textareas by default.
Command line tools
There is also a command line tool that allows you to download articles, edit them using your favorite text editor, and upload the edited articles back into the Wikipedia. This bypasses the need for a web browser. It is:
- mvs, a Perl program available from CPAN. There's more information at Meta:WWW::Mediawiki::Client
How to use specific editors for Wikipedia editing
GNU Emacs
There are a couple of Emacs major modes available for editing Wikipedia articles:
- wikipedia-mode.el is a simple major mode that mostly provides syntax highlighting for wikipedia markup.
- wikipedia.el is a much more advanced major mode which provides WYSIWYG editing of wikipedia articles. Note, however, that it is developed using the current CVS version of GNU Emacs, and may not be compatible with older versions. It is also in the alpha stage of development, so use it at your own risk.
Since Wikipedia articles don't use line breaks. You should either install screen-lines.el, which redefines movement commands to work in terms of screen lines as opposed to text lines, or install longlines.el, which implements "word wrap" functionality for Emacs (longlines.el
is now part of GNU Emacs). Installation instructions are here.
Eclipse
The Wikipedia editor plugin plog4u.org is available for Eclipse. With an automatically updating outline of the article. It has many features which are very helpful for editing wikipedia. It also downloads articles directly from Wikipedia and has highlighting.
Vim
To make Vim support the MediaWiki markup used on Wikipedia, save Wikipedia.vim to your "syntax" directory. By default, this directory is "~/.vim/syntax" on a Unix system, and "C:\Program Files\Vim\vimfiles\syntax" on a Windows system.
To autodetect files ending in ".wiki", add the following lines to ".vim/filetype.vim" or "vimfiles\filetype.vim" (or create the file if it doesn't exist):
augroup filetypedetect au BufNewFile,BufRead *.wiki setf Wikipedia augroup END
Alternatively, add the following line to the vimrc
file (typically ~/.vimrc on Unix and C:\Program Files\Vim\_vimrc on Windows):
au BufRead,BufNewFile *.wiki setfiletype Wikipedia
Alternatively, the command "set syn=Wikipedia" will temporarily set the syntax for the current file.
Wikipedia articles often only have line-breaks at the end of each paragraph, a situation Vim doesn't handle gracefully by default. Save the following lines to "~/.vim/ftplugin/Wikipedia.vim" or "vimfiles\ftplugin\Wikipedia.vim" to make it easier (you may need to put "filetype plugin on" in your vimrc
).
setlocal textwidth=0 setlocal linebreak nmap <buffer> k gk nmap <buffer> j gj nmap <buffer> <Up> gk nmap <buffer> <Down> gj imap <buffer> <Up> <C-O>gk imap <buffer> <Down> <C-O>gj vmap <buffer> k gk vmap <buffer> j gj vmap <buffer> <Up> gk vmap <buffer> <Down> gj
Please feel free to edit Wikipedia.vim and upload an improved copy, or to check on the vim-devel list if anyone has requested the upload of Wikipedia.vim, and if not, to request it. (As of January 11, 2006, it is not in Vim CVSWeb's "syntax/" directory.)
jEdit
For jEdit there is a plugin available at http://www.djini.de/software/mwjed/ . Apart from providing syntax highlighting for wikipedia markup, it can communicate directly with the Wikipedia website using the HttpClient component from the Jakarta Project.
Kate / kwrite
For Kate (for GNU/Linux KDE desktop), rules for syntax highlighting are provided by the XML file de:Media:Wikimedia.xml. It recognizes HTML tags and entities, wiki control characters, links, section titles, tables and <nowiki> sections.
To install this template, copy it to ~/.kde/share/apps/katepart/syntax/
for per user settings or $(PREFIX)/share/apps/katepart/syntax/
for global settings. There's also an import tool : Settings → Configure Kate → Highlighting → Download
.
SubEthaEdit
A syntax highlighting mode is available for SubEthaEdit as well. After downloading the mode bundle, drop it in /Library/Application Support/SubEthaEdit/Modes/
(system-wide) or ~/Library/Application Support/SubEthaEdit/Modes/
(user-specific). You may need to create the final two directories by hand. The mode will be automatically selected for files with a .wiki or .wikipedia extension.
NoteTab
A Clip Library plugin for the NoteTab text editor contains some functions to automate Wiki markup.
Dealing with special characters
The English Wikipedia (and most others) are now encoded using the UTF-8 character set, which allows the use of many foreign language characters and special symbols. Such characters may appear even in articles where you wouldn't expect them due to the use of interwiki links to foreign-language versions of the article. Therefore, it's very important to use an editor that does not mangle these characters or replace them with question marks. Check your editor's documentation to make sure that it supports Unicode or UTF-8, and enable it if needed. You don't necessarily need a special editor; recent versions of Notepad and Microsoft Word support Unicode, for example. An extensive list of Unicode-supporting editors is available for Windows and other operating systems.
When making an edit to an article with special characters using a new editor, it's a good idea to use the "Show changes" button (next to "Show preview") see exactly what changes your edit will make - if areas with special characters that you didn't intend to modify are highlighted as red, that means they will be corrupted, even though both versions may look the same to you because you don't have foreign fonts installed.
BabelPad is a free editor for Windows with special support for dealing with Unicode, and is ideal if you need to determine which of several similar-looking characters an article is using, or deal with hard-to-edit Unicode control codes (like for multidirectional text).