Difference between revisions of "Visual editor"
(Updated for 2023) |
|||
(39 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | The [http://www.mediawiki.org/wiki/VisualEditor Visual Editor] for MediaWiki relies on the '''[[mw:Extension:Parsoid|Parsoid]]''' extension <ref>[https://git.wikimedia.org/tree/mediawiki%2Fextensions%2FParsoid Parsoid extension]</ref> AND the Parsoid service. The Parsoid service is a node.js server that interacts with the mediawiki API. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | <blockquote>"Parsoid implements a bidirectional wikitext parser and interpreter. It converts and interprets wikitext into an annotated HTML DOM, which can then be edited with HTML editor tools such as the Visual Editor. It also provides the conversion of a (possibly modified) HTML DOM back to wikitext."</blockquote> | ||
− | [ | + | [http://xml.coverpages.org/ Robin Cover] would be proud. It round-trips wiki to HTML + RDFa and back. |
− | |||
− | |||
− | |||
− | |||
− | == | + | == Installation == |
− | + | You'll need at least [http://www.mediawiki.org/wiki/Release_notes/1.23 MediaWiki v1.23]. I personally run the same [http://www.mediawiki.org/wiki/Special:Version version that they're running on mediawiki.org] (1.24wmf3 [[User:Freephile|greg.rundlett]] ([[User talk:Freephile|talk]]) 19:39, 9 May 2014 (UTC)) | |
+ | === WebFaction === | ||
− | + | To install the Visual Editor extension in a Webfaction account, you need to first have node installed and working. You can do this by using the [http://docs.webfaction.com/software/custom.html installer in your webfaction panel] and associating a path with the app for a domain. I chose to install 'node' (which is now it's own one-click install). Once you do that you can [https://freephile.org/node visit the path] you configured for node and you should see the "hello world" app that the installer puts in place. You'll need to stop that app, plus remove the cron job that respawns it. Then, in order to reserve and associate a port for the service, you install another 'app'. You do not need to open this port in the firewall unless you plan to share it with other instances, since HTTP talks to the node server on the backend. (I had to export the PORT, but this is no longer necessary if you configure it in localsettings.js.) Depending on the resource constraints of your hosting package, you may need to limit the number of workers spawned by the Parsoid service. It calculates a number based on the number of processors. For a shared hosting account, this is guaranteed to exceed your RAM or CPU limits, so specify the <code>--num-workers</code> option unless you're running on a dedicated host or VM. | |
− | + | Follow the installation instructions, and remember to edit both LocalSettings.php and localsettings.js When you setup the "interwiki" link to point to your API endpoint, you can choose pretty much whatever name you want to give it. The example is 'localhost'. | |
− | |||
− | |||
− | |||
− | < | + | You'll want to set/update your $NODE_PATH and $PATH environment variables to locate the installed node modules, and to find the node and npm binaries |
+ | <source lang="bash"> | ||
+ | export NODE_PATH="$HOME/webapps/node/lib/node_modules:$NODE_PATH" | ||
+ | echo 'export NODE_PATH="$HOME/webapps/node/lib/node_modules:$NODE_PATH"' >> $HOME/.bashrc | ||
+ | which npm | ||
+ | export PATH="$HOME/webapps/node/bin:$PATH" | ||
+ | echo 'export PATH="/$HOME/webapps/node/bin:$PATH"' >> $HOME/.bashrc | ||
+ | </source> | ||
− | + | Once node (and npm) is available, you of course need to get the parsoid and visual_editor extensions. A quick <code>npm install</code> in the parsoid directory sets up all the node machinery. | |
− | = | + | To have it run continuously, you might want to use the 'forever' module. |
− | + | <source lang="bash"> | |
+ | npm install -g forever | ||
+ | cd ~/webapps/wiki/extensions/Parsoid/ | ||
+ | forever node api/server.js --num-workers=2 & | ||
+ | </source> | ||
+ | ==== Info ==== | ||
+ | * https://docs.webfaction.com/software/nodejs.html | ||
== Extensions == | == Extensions == | ||
# [[mw:Extension:VisualEditor]] | # [[mw:Extension:VisualEditor]] | ||
# [[mw:Extension:Parsoid]] | # [[mw:Extension:Parsoid]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== API / Developer Docs / DevOps == | == API / Developer Docs / DevOps == | ||
Line 71: | Line 47: | ||
* https://doc.wikimedia.org/VisualEditor/master/ powered by JSDuck | * https://doc.wikimedia.org/VisualEditor/master/ powered by JSDuck | ||
* http://blog.gmane.org/gmane.science.linguistics.wikipedia.wikitext wikitext-l | * http://blog.gmane.org/gmane.science.linguistics.wikipedia.wikitext wikitext-l | ||
+ | |||
+ | I [https://gerrit.wikimedia.org/r/#/c/132479/1/api/ParsoidService.js noticed a bug] and it was fixed about 5 minutes after I mentioned it! (Thanks C. Scott Ananian) | ||
{{References}} | {{References}} | ||
[[Category:Wiki]] | [[Category:Wiki]] | ||
− |
Revision as of 16:20, 9 May 2014
The Visual Editor for MediaWiki relies on the Parsoid extension [1] AND the Parsoid service. The Parsoid service is a node.js server that interacts with the mediawiki API.
"Parsoid implements a bidirectional wikitext parser and interpreter. It converts and interprets wikitext into an annotated HTML DOM, which can then be edited with HTML editor tools such as the Visual Editor. It also provides the conversion of a (possibly modified) HTML DOM back to wikitext."
Robin Cover would be proud. It round-trips wiki to HTML + RDFa and back.
Contents
Installation[edit | edit source]
You'll need at least MediaWiki v1.23. I personally run the same version that they're running on mediawiki.org (1.24wmf3 greg.rundlett (talk) 19:39, 9 May 2014 (UTC))
WebFaction[edit | edit source]
To install the Visual Editor extension in a Webfaction account, you need to first have node installed and working. You can do this by using the installer in your webfaction panel and associating a path with the app for a domain. I chose to install 'node' (which is now it's own one-click install). Once you do that you can visit the path you configured for node and you should see the "hello world" app that the installer puts in place. You'll need to stop that app, plus remove the cron job that respawns it. Then, in order to reserve and associate a port for the service, you install another 'app'. You do not need to open this port in the firewall unless you plan to share it with other instances, since HTTP talks to the node server on the backend. (I had to export the PORT, but this is no longer necessary if you configure it in localsettings.js.) Depending on the resource constraints of your hosting package, you may need to limit the number of workers spawned by the Parsoid service. It calculates a number based on the number of processors. For a shared hosting account, this is guaranteed to exceed your RAM or CPU limits, so specify the --num-workers
option unless you're running on a dedicated host or VM.
Follow the installation instructions, and remember to edit both LocalSettings.php and localsettings.js When you setup the "interwiki" link to point to your API endpoint, you can choose pretty much whatever name you want to give it. The example is 'localhost'.
You'll want to set/update your $NODE_PATH and $PATH environment variables to locate the installed node modules, and to find the node and npm binaries
export NODE_PATH="$HOME/webapps/node/lib/node_modules:$NODE_PATH"
echo 'export NODE_PATH="$HOME/webapps/node/lib/node_modules:$NODE_PATH"' >> $HOME/.bashrc
which npm
export PATH="$HOME/webapps/node/bin:$PATH"
echo 'export PATH="/$HOME/webapps/node/bin:$PATH"' >> $HOME/.bashrc
Once node (and npm) is available, you of course need to get the parsoid and visual_editor extensions. A quick npm install
in the parsoid directory sets up all the node machinery.
To have it run continuously, you might want to use the 'forever' module.
npm install -g forever
cd ~/webapps/wiki/extensions/Parsoid/
forever node api/server.js --num-workers=2 &
Info[edit | edit source]
Extensions[edit | edit source]
API / Developer Docs / DevOps[edit | edit source]
- mw:Parsoid/Setup
- mw:Parsoid/Troubleshooting
- mw:Parsoid/Debugging
- mw:Parsoid/Packaging
- DevOps (Wikitech)
- https://doc.wikimedia.org/VisualEditor/master/ powered by JSDuck
- http://blog.gmane.org/gmane.science.linguistics.wikipedia.wikitext wikitext-l
I noticed a bug and it was fixed about 5 minutes after I mentioned it! (Thanks C. Scott Ananian)