Help:Text editor support: Difference between revisions

Content deleted Content added
QuickWikiEditor: updated link
m Bluefish article is reinstated on Mediawiki, so re-adding it as editor
(12 intermediate revisions by 10 users not shown)
Line 1:
{{Wikipedia how-to|WP:TEXTES}}
It is often convenient to [[Wikipedia:How to edit a page|editEditing Wikipedia articles]] using a full-fledged [[text editor]], insteadis ofoften themore standard text areaconvenient ofthan a web browser's standard text area. Text editors provide facilities that are very useful for writing and editing articles (especially ''long'' articles), such as [[spell checker|spell checking]], search and replace, [[Macro (computer science)|macros]], [[syntax highlighting]], and alphabetic sorting. They also provide a quick and easy way of saving a local backup copy of an article, possibly for future offline editing. [[#wikEd|wikEd]] for Wikipedia (Preferences > Gadgets > Editing) supports some of these features, and some browsers support spell-checking. In any case, you can select Wikipedia [[VisualEditor]] for a visual editing, [[wikipedia:VisualEditor|in your user preferences]].
 
This page contains pointers for adapting several external and in-browser text editors to editing Wikipedia articles.
Line 25:
If you are using the [[Mozilla]] web browser, it is possible to configure an external editor for editing text areas, including the Wikipedia edit area. This then avoids the need to copy and paste the article text between browser and editor. Several solutions exist:
 
* '''[https://addons.mozilla.org/en-US/firefox/addon/its-all-text/?src=ss It's All Text!]''', supports nonblocking editing and UTF-8 encoding. '''Note:''' If you ''also'' want ''syntax highlighting'' in your edit box, this addon may be incompatible with the highlighting in {{myprefs|Beta features}}, but works with the highlighting in {{myprefs|Gadgets}}. (See below for highlighting ''within Vim''.) '''Note: Stopped working onin Firefox 57+.'''
* '''[http://www.vimperator.org/vimperator Vimperator]''' and '''[http://dactyl.sourceforge.net/pentadactyl/ Pentadactyl]''' have a shortcut in Insert mode that allows external text editing (the default is '''[[Control key|Ctrl]]+i'''). '''Note: Stopped working onin Firefox 57+.'''
* '''[https://github.com/GhostText/GhostText GhostText]'''. An extension for both Chrome and Firefox (including Quantum) where everything that you type in your editor appears instantly in the web-browser. Requires separate installation ofinstalling an editor plugin separately.
* '''[https://github.com/jlebon/textern textern]''' Another Firefox-Quantum-compatible replacement for ''It's all Text''. In addition to the [https://addons.mozilla.org/de/firefox/addon/textern/ addon], it requires a separate installation ofinstalling a server separately. Only supports [[Linux]].
*'''MozEx.''' The [http://mozex.mozdev.org/ official package]{{dead}} does not support editing [[UTF-8]]-encoded documents and does not install properly onin [[Mozilla Firefox]]. However, the [http://mozex.mozdev.org/development.html development version]{{dead}} does not have these problems. A quick [[Wikipedia:MozEx tutorial|MozEx tutorial]] is available.
*'''[http://dafizilla.sourceforge.net/viewsourcewith/ ViewSourceWith]''' provides similar functionality vis-à-vis the text editing.
* '''[http://lib.custis.ru/index.php/TextArea_Sputnik/en TextArea Sputnik]''', supports nonblocking editing and different encodings in an external editor. (You may see question marks in an edit textbox unrelated to the editscontent you are makingediting (for example, the [[Unicode]] [[grapheme]] and other [[glyphs]] at the bottom), but your edits won't destroy the characters.)
 
* '''[https://addons.mozilla.org/en-US/firefox/addon/withexeditor/ withExEditor]''' supports nonblocking editing in an external editor. As of this writing, it is common for other external editor plugins (It's All Text, ViewSourceWith) to not support multi-process (aka e10s) Firefox, whereas withExEditor does.
Line 52:
After editing, just save the file from your editor. The contents are automatically copied to the text area in Firefox. To indicate this, the text area turns yellow briefly.
 
A temporary file is created for editing and it is removed at the end. So if you want to preserve a text file for later editing, you can change the file name and/or save the file to another directory.
 
=====Using Vim or another console editor=====
Some macros may work underin [[Vim_(text_editor)#Interface|Vim]], but not underin [[Vim_(text_editor)#Interface|gVim]] for some reason (e.g., the macro to format text paragraphs). Or you just want to use Vim within an X terminal as you used to do, instead of using gVim. To invoke Vim within an X terminal window, you can write a shell script (see below) to invoke an X terminal and to run the <code>vim</code> command within that X terminal, or generally your preferred editor. Assume that the filename of this script is <code>wiki.edit.vim</code>, and that you put the script in the directory <code>/home_dir/bin/</code> so that the path of the script would be
<code>/home_dir/bin/wiki.edit.vim</code>
Put the above path in the Preferences box (instead of <code>/usr/bin/gvim</code>) of It's All Text. It should work. Note that <code>/home_dir/</code> is the complete path to your home directory from the root (<code>/</code>) directory; don't use <code>~/</code> (tilde) instead of <code>/home_dir/</code>; it won't work.
Line 66:
Don't forget to make the file executable with <code>$ chmod +x wiki.edit.vim</code>
 
=====Using Vim onin macOS=====
To get It's All Text to work nicely with Vim onin the Mac, you need to install [http://code.google.com/p/macvim/ Macvim]. When MacVim is installed, a script called mvim is also added. You need to tell It's All Text to use this script and not the MacVim.app file. A good place to keep it is in the same folder your MacVim.app file is (Applications by default).
 
=== Lynx ===
Line 76:
After saving the file in an external editor, quitting it and returning to Lynx, answer "no" to the Lynx question "Wrap lines to fit displayed area? (n)" by pressing the {{key press|N}} key; answering "yes" will otherwise have Lynx wrap lines with normal carriage returns, which will break the document structure. Using article preview is strongly encouraged.
 
==== Line and paragraph breakagebreaking ====
Lynx has a built-in hard limit onlimits line length. In version 2.8.3, find this line in <code>LYGlobalDefs.h</code>:
: #define MAX_LINE 1024
This can be modified to a longer length (e.g. 8192) and recompiled. If you are unable to recompile Lynx, the following are workaround suggestions.
Line 129:
'''<CODE>lynx.cfg</CODE>''' is the config file for Lynx; the global config file in Windows is always located in the same folder as the Lynx executable, wherever it has been installed to. A typical location is <CODE>C:\Program Files\Lynx</CODE>. If Lynx is installed in that folder, then Windows Vista and newer usually require administrator access to edit the file (via User Account Control).
 
'''<CODE>lynx.rc</CODE>''' is a per-user Lynx User Defaults File saved from the Options page. Settings in it take priority over the global config file. In Windows Vista, the per-user User Defaults file can be in <CODE>C:\Users\''Username''\AppData\Local\temp\lynx.rc</CODE>. If the file is in the <CODE>temp</CODE> directory, care is advised when using automated cleanup tools, such aslike Disk Cleanup.
 
Lynx Option file syntax is different between global (lynx.cfg) and per-user (lynx.rc) configuration files.
Line 137:
The best way to find an option is by using the text editor's find feature.
 
When not in active use, an option is commented out with a hash <CODE>#</CODE> and its default setting is on; To use an option, delete the hash character before it. It may occasionally happen that theThe config file doesmay occasionally not contain a specific option, but it can be added by the user.
 
===== Defaults to reconsider =====
The following options are often found as defaults in Lynx binaries compiled for Windows and might not meet formatting conventions used in Wikipedia. These options can be edited from <CODE>lynx.cfg</CODE> and are usually not specified in the Options page. Before making changesediting, makeback a backup copy ofup the file, renamingand rename it to <CODE>lynx.cfg.old</CODE>, for example.
 
====== Collapsed <NOWIKI><BR></NOWIKI> tags ======
Line 181:
 
==== Luakit ====
[https://luakit.github.io/ Luakit] is able to edit text boxes using an external editor by pressing {{key press|Ctrl|e}} on the focused text box. The external editor functionality is powered by the <code>editor</code> and <code>open_editor</code> Lua modules powers the external editor functionality. User configuration is done by editing a <code>userconf.lua</code> file and key bindings are changed with the <code>add_binds</code> and <code>remove_binds</code> functions.
 
==== Nyxt ====
Line 196:
 
==== vimprobable ====
[https://sourceforge.net/p/vimprobable/wiki/Home/ vimprobable] can open text boxes in an external editor by typing {{key press|Ctrl|t}} while in Insert Mode. User configuration is done by making edits toediting a <code>vimprobablerc</code> file. To change the key binding, use the <code>map</code> command on the <code>openeditor</code> function. To define a different editor, use the <code>handler</code> command to change the <code>vimprobableedit</code> URI schema.
 
==== w3m ====
Line 208:
 
===Command-line tools===
There are alsoSome [[command line interface|command line]] tools that allow you to download articles, edit them using your favorite text editor, and upload the edited articles back into Wikipedia (or into any MediaWiki server). This bypasses the need for a web browser. These are (at least):
 
* [http://search.cpan.org/~markj/WWW-Mediawiki-Client/bin/mvs mvs], a [[Perl]] program available from [[CPAN]]. There's more information at [[Meta:WWW::Mediawiki::Client]] has more information. Unfortunately, mvs uses the name of the local file as the title of the page for the wiki remote server. If you need title pages in UTF-8 for Russian, Japanese or Arabic for example, you won't be able to upload such files. It seems that Mediawiki::Client as well as Perl libraries are not enough advanced in the management ofmanaging UTF-8 characters to be fully operational, even if your terminal and shell are correctly set for UTF-8. But see [http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=libwww-mediawiki-client-perl Debian bug reports].
 
* [[mw:Manual:Pywikibot]] is an extensive library and set of utilities for doing innumerable things with Wikipedia. It can also do something as simple as editing Wikipedia pages. It has some ways to avoid the wrong transmission oftransmitting titles in UTF-8 wrongly, for example it allows to incorporate the name of the title ''within'' the file itself and to use another command line tool. The local filename could then be written in simple ASCII. Here is an example of a file, named locally 'foo.wiki', using pagefromfile.py (from [[mw:Manual:Pywikibot]]):
<div style="height:auto; overflow:auto;"><pre>
{{-start-}}'''Демография''', или наука о народонаселении, изучает численность, состав, размещение и движение населения.
Line 235:
 
===Atom===
At[[Atom_(text_editor)|Atom]] requires at least one of the two packages is required for [[Atom_(text_editor)|Atom]] to support syntax highlighting. Install packages using '''Command-,''' - '''Install''' and search for:
* language-mediawiki
* language-markdown
 
===Bluefish===
[[Bluefish_(software)|Bluefish]] supports Mediawiki syntax by default. If the auto-detection of the document language fails select the menu Document → Language → Mediawiki to enable syntax highlighting and auto completion. Specific Mediawiki syntax highlighting options can be configured in the Preferences panel under Language support → Mediawiki.
 
===GNU Emacs===
There are aA few [[Emacs]] ''major mode'' implementations are available for editing MediaWiki syntax:
 
* [[Meta:Mediawiki.el|Mediawiki.el]], see [http://github.com/hexmode/mediawiki-el mediawiki.el on github]. “…"… adds the ability to edit sites hosted on Mediawiki (including Wikipedia, of course)."
* wikitext-mode.el, see [https://www.emacswiki.org/emacs/WikitextMode WikitextMode on EmacsWiki]. Derived from WikipediaMode v.0.3.3. Source is [https://www.emacswiki.org/emacs/wikitext-mode.el available] but documentation has [[link rot|link rotted]].
* [[Wikipedia:wikipedia-mode.el|wikipedia-mode.el]] (obsolete) is a simple major mode that mostly provides [[syntax highlighting]] for MediaWiki [[mark-up]].
* [http://www.gna.org/projects/wikipedia-el/ wikipedia.el] (obsolete) is a much more advanced major mode. whichIt provides [[WYSIWYG]] editingeditor offor Wikipedia articles. Note, however, that it is developed using the current [[Concurrent Versions System|CVS]] version of GNU Emacs, may not be compatible with older versions, and has been effectively discontinued because it's not being actively maintained. Also, the mode was in the [[Software release life cycle#Alpha|alpha stage of development]] when it was orphaned, so use it at your own risk.
 
====Line formatting====
Line 250 ⟶ 255:
 
Wikipedia articles [[Wikipedia:don't use line breaks|don't use line breaks]]. Because of this, you may want to install one of the following:
* [http://www.emacswiki.org/elisp/longlines.el longlines.el] — implements “word"word wrap”wrap" functionality for Emacs (<code>longlines.el</code> is now part of GNU Emacs). [[Wikipedia:Wikipedia-mode.el#Installing longlines-mode|Installation instructions for <code>longlines.el</code>]].
* [http://homepage1.nifty.com/bmonkey/emacs/elisp/screen-lines.el screen-lines.el] — redefines movement commands to operate in terms of screen lines as opposed to logical lines
 
Line 276 ⟶ 281:
Highlighting can be configured in <code>Settings → Configure Kate → Fonts & Colors → Highlighting Text Styles</code> and select "Markup/MediaWiki" in the drop-down menu.
 
There is also a highlighting import tool : <code>Settings → Configure Kate → Fonts & Colors → Highlighting Text Styles → Highlight: → Import button</code>.
 
Kate dynamically wraps lines.
Line 282 ⟶ 287:
===gedit===
 
[[gedit]] is a cross-platform, free software text editor that comes bundled with [[Ubuntu (operating system)|Ubuntu]] Linux by default. There is aA [[GPL]]-licensed MediaWiki syntax highlight mode is shipped by default with ''gedit 3.10'' and newer.
 
For older versions, you can download it at https://github.com/jpfleury/gedit-mediawiki/archive/master.zip, unzip, and copy the language file to the correct folder, or you can run the following in a GNU/Linux shell:
Line 311 ⟶ 316:
 
===TextMate===
A "MediaWiki" bundle is available in the [[TextMate]] for [[macOS]] bundle subversion repository. The bundle could ne enabled through the app preference pane GUI by checking a tickbox. To learn how to load this bundle manualy, see the [http://macromates.com/textmate/manual/bundles#getting_more_bundles TextMate manual page] about installing more bundles, or view this [[shell script]] that downloads and installs it. [http://netcetera.org/cgi-bin/tmbundles.cgi?bundle=%4D%65%64%69%61%77%69%6B%69]. The bundle does syntax highlighting, code completion, and other actions.
 
For [[Sublime Text]] 2 users, note that you may enable this bundle as well, since Sublime Text 2 supports TextMate bundles.
Line 344 ⟶ 349:
 
===Vim===
Please feel free to contribute improvements to the below scripts, or check the [httphttps://newswww.gmanevim.org/gmane.editorsmaillist.php#vim.devel-dev vim-develdev list] if anyone has requested the upload of mediawiki.vim Syntax & FileType plugin. If not, request it and/or post the reasons why they are not here. {{as of | 2017 | March}}, it is not in [https://github.com/vim/vim/tree/master/runtime/syntax the Vim source control tree's "syntax/" directory].)
 
The below scripts are also posted in the [http://www.vim.org/scripts/script.php?script_id=1787 vim.org script collection], where they are occasionally updated (but not since 2011-11-17) with newer versions taken from community contributions on this site. Feel free to remind [[User:Mvc|mvc]] to upload a newer copy periodically if those become stale, since they were uploaded from his vim.org account.
Line 353 ⟶ 358:
A raw mediawiki.vim file for easy downloading exists on GitHub:<br/>https://raw.githubusercontent.com/chikamichi/mediawiki.vim/master/syntax/mediawiki.vim
 
When using Vim in Windows, it's preferable to createcreating and savesaving mediawiki.vim in Vim itself is preferable, otherwise the file may become brokenbreak.
 
{{cot|title=File <samp>mediawiki.vim</samp>}}
Line 793 ⟶ 798:
[[Notepad++]] is a free text and [[Source code editor|source code editor]] for [[Microsoft Windows]]. It allows users to create their own syntax highlighting scheme; users can customize a new scheme using the mediawiki markup scheme, or [[User:MjolnirPants/mediawiki lang npp|install an existing version]] provided by the Wikipedia user [[User:MjolnirPants|MjolnirPants]].
 
Notepad++ supports plugins; there is a 2009 mediaWiki plugin for the 32-bit version that can be downloaded at [http://www.cab.i24.cc/projects/wikieditor/ http://www.cab.i24.cc/projects/wikieditor/] ([https://web.archive.org/web/20231001185805/http://www.cab.i24.cc/projects/wikieditor/ Internet Archive]).
 
===LibreOffice Writer===
The previous methods allow a Wikipedia Edit page to be processed more efficiently. [[LibreOffice Writer|LibreOffice (LO) Writer]] can be used for this purpose; but it is also possible to useusing LO Writer to convert a formatted document into Wikipedia edit format is also possible. This requires the use ofusing styles and other LO features, explained in LO Writer Help > MediaWiki Formats; for example the Heading 2 style must be used if a heading is to be enclosed within a pair of "==". This is supported, at least, in LO 5 under Windows 10 with the appropriate 32- or 64-bit [[Java Runtime Environment]] (JRE) present and enabled in LO; the procedure is File > Export > MediaWiki (.txt). See [[Help:WordToWiki]].
 
==In-browser editors==
Line 810 ⟶ 815:
* Edit preview and show changes on the same page without reloading
* MS-Word and web page import (including tables)
* Single1-click fixing of common mistakes
 
wikEd can simply be enabled underin [[Special:Preferences#mw-prefsection-gadgets|Preferences::Gadgets]] (on wiki installations where wikEd is not installed as a gadget, a small code snippet can be pasted to your [[Special:Mypage/common.js|''common.js'']] page or it can be run locally as a [[Greasemonkey]] user script). For detailed installation instructions see the [[User:Cacycle/wikEd#Installation|wikEd homepage]].
 
=== QuickWikiEditor ===
Line 827 ⟶ 832:
==Dealing with special characters==
 
Text on Wikipedia isencodes encodedtext using the [[UTF-8]] character set, which allows the use ofusing many non-English 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 non-English versions of the article. Therefore, it's very important to useusing an editor that does not mangle these characters or replace them with question marks is very important. 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 (Windows)|Notepad]] and [[Microsoft Office Word|Microsoft Word]] support Unicode, for example. An extensive list of Unicode-supporting editors is available for [http://www.alanwood.net/unicode/utilities_editors.html Windows] and [http://www.alanwood.net/unicode/utilities.html other operating systems] (see also: [[Comparison of text editors]]).
 
If your editor does not support UTF-8, then copy-paste from web browser may mangle the characters. For example, pasting from Windows Clipboard automatically converts characters to whatever character set is used in your editor uses and replace any characters not included in this character set are replaced with question marks. You can avoid this by using one of the helper applications or browser plugins mentioned above. For example, ''It's All Text!'' does not mangle any characters.
 
When making an edit toediting an article with special characters using a new editor, it's a good idea to useusing the "Show changes" button (next to "Show preview") to see exactly what changes your edit will makechange is a good idea. 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.
 
[http://www.babelstone.co.uk/Software/BabelPad.html 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).