TIP EditSyntaxPlugin is not installed on Foswiki.org.

Edit Syntax Plugin (Alpha version - unsafe for public websites)

This Plugin allows users to edit Foswiki content with their favorite wiki syntax. Users can set their preferred syntax as a user preferences setting in their user homepage. Edit syntax converters convert the Topic markup language (TML) into another syntax when a user edits a topic, and converts it back after edit. The content is always saved in the Foswiki format, that is, users can edit the same content using different edit syntax.

Syntax Rules, and How to Activate another Edit Syntax

The edit syntax rules depend on the edit syntax converter activated by a user.

Currently available converters:
Syntax To Activate Syntax Summary and Help Converter topic
Foswiki   * Set EDITSYNTAX = Summary, Help N/A

Syntax converters are activated with an EDITSYNTAX preferences setting in the user homepage. Copy these bullets to the Personal Preferences section:

      * Activate preferred edit syntax (see available edit syntax converters at System.EditSyntaxPlugin) :
         * Set EDITSYNTAX = Mediawiki

To disable the converter (e.g. to use Foswiki syntax), set the EDITSYNTAX to an empty value.

How to Create a New Edit Syntax Converter

Steps to create a new edit syntax converter, using the FooWiki syntax as an example:
  1. Decide on the base name, Foowiki. Base name must not be a WikiWord, e.g. not FooWiki.
  2. Create a FoowikiEditSyntaxRegex topic in the System web, taking MediawikiEditSyntaxRegex as a template.
    • List regular expressions to convert the syntax from the Foswiki to the Foowiki format, and vice versa.
    • The converter format is indicated below.
    • All topics ending in *EditSyntaxRegex are listed automatically in the converter topic.
  3. Create a FoowikiWikiSyntaxSummary syntax summary topic in the System web, taking MediawikiWikiSyntaxSummary as a template.
    • This is the short help text shown in the edit screen.
    • Replace /MediawikiTextFormattingRules in the "more formatting help" link with /FoowikiTextFormattingRules.
  4. Create a FoowikiTextFormattingRules syntax help topic in the System web, taking MediawikiTextFormattingRules and/or Foowiki's edit syntax help text as a template.
    • This is the extensive help text shown when the users clicks on the "more formatting help" link.

Format of Edit Syntax Regular Expression Converter Topic

The converter topic contains bullets of format: * TYPE: /from/to/ or * TYPE: /from/to/ # comment
  • TYPE is T2X for "TML (Foswiki topic markup language) to External" syntax conversion, or X2T for "External to TML" syntax conversion.
  • /from/to/ are regular expressions to convert from one format to the other.
  • # comments to annotate the expressions are optional. The hash sign requires a space to be recognized as a space.
  • Empty lines are ignored.
  • The sequence of regular expressions is relevant.

Example lines:
  • T2X: /(^|[\n\r])---\+([^\n\r]*)/$1=$2 =/
  • X2T: /(^|[\n\r])=(.*?) ?=(?=[\n\r]|$)/$1---\+$2/ # H1

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %EDITSYNTAXPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Edit Foswiki content using your preferred wiki syntax

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the Foswiki server.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip EditSyntaxPlugin.zip in your Foswiki installation directory. Content:
    File: Description:
    data/System/EditSyntaxPlugin.txt Plugin topic
    data/System/MediawikiEditSyntaxRegex.txt Mediawiki edit syntax converter topic
    data/System/MediawikiWikiSyntaxSummary.txt Mediawiki edit syntax summary topic
    data/System/MediawikiTextFormattingRules.txt Mediawiki edit syntax help topic
    data/System/MediawikiEditSyntaxTest.txt Mediawiki edit syntax test topic
    lib/Foswiki/Plugins/EditSyntaxPlugin.pm Plugin Perl module
  • Configure the Plugin:
    • Run the configure script to enable the Plugin
    • Change the Plugin settings as needed
  • Test if the installation was successful:
    • Enable the Mediawiki syntax with this setting in your home page:
      • Set EDITSYNTAX = Mediawiki
    • Edit a test topic that contains headings, bullets, bold text and italic text
      • You should see the content in Mediawiki syntax
      • Save the test topic
      • View raw should show you the content in Foswiki syntax
  • Show proper edit syntax summary in edit screen:
    • Create an EDITSYNTAX setting in your Main.SitePreferences and set it to an empty value
    • Edit foswiki/templates/edit.pattern.tmpl and change "%SYSTEMWEB%.WikiSyntaxSummary" to "%SYSTEMWEB%.%EDITSYNTAX%WikiSyntaxSummary"
    • Change other foswiki/templates/edit.*.tmpl template files as needed
  • Secure the *EditSyntaxRegex converter topics so that only AdminGroup members can edit the topics.


  • Security risk: The current implementation does no sanity check on the regular expressions of the Edit Syntax Converter topics. It is potentially possible to execute arbitrary Perl code by editing one of the converter topics. Secure the *EditSyntaxRegex converter topics so that only AdminGroup members can edit the topics. It is not recommended to use this Plugin version on a public website.
  • The MediawikiEditSyntaxRegex does not yet convert tables.

Plugin Info

Plugin Author: TWiki:Main.PeterThoeny
Copyright: © 2006, TWiki:Main.PeterThoeny
License: GPL (GNU General Public License)
Plugin Version: 09 Jul 2006 (V1.000)
Change History:  
17 Apr 2009: Ported to Foswiki -- Foswiki:Main.WillNorris
09 Jul 2006: Initial version
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
Plugin Home: http://foswiki.org/Extensions/EditSyntaxPlugin
Support: http://foswiki.org/Support/EditSyntaxPlugin

Related Topics: Plugins, DeveloperDocumentationCategory, AdminDocumentationCategory, DefaultPreferences, SitePreferences

-- TWiki:Main.PeterThoeny - 09 Jul 2006,
-- Foswiki:Main.WillNorris - 17 Apr 2009
Topic attachments
I Attachment Action Size Date Who Comment
EditSyntaxPlugin.md5md5 EditSyntaxPlugin.md5 manage 171 bytes 17 Apr 2009 - 21:22 WillNorris  
EditSyntaxPlugin.sha1sha1 EditSyntaxPlugin.sha1 manage 195 bytes 17 Apr 2009 - 21:22 WillNorris  
EditSyntaxPlugin.tgztgz EditSyntaxPlugin.tgz manage 9 K 17 Apr 2009 - 21:22 WillNorris  
EditSyntaxPlugin.zipzip EditSyntaxPlugin.zip manage 15 K 17 Apr 2009 - 21:22 WillNorris  
EditSyntaxPlugin_installerEXT EditSyntaxPlugin_installer manage 4 K 17 Apr 2009 - 21:22 WillNorris  
Topic revision: r1 - 17 Apr 2009, WillNorris - This page was cached on 25 Oct 2016 - 17:34.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License