Quick links: Content - sections - sub sections
EN FR

The wiki editor provides a toolbar for easy formatting of the text.

for this, MarkItUp has been integrated.

Editor Configuration

A configuration for Markitup should have a name, that will be used in the <wikieditor> element. This name is also used as prefix of parameters into the Jelix configuration in the wikieditors section.

Here is the default configuration, named default:


[wikieditors]

default.engine.name = wr3
default.wiki.rules = wr3_to_xhtml

where :

  • "default" is the name of the editor
  • default.engine.name is the name of the engine, used for the render
  • default.wiki.rules is the name of the rules transformation

You have also to specify CSS and JS files. You should use the webassets. The webassets group for wikieditor should have a name with the configuration name (here default) and a prefix jforms_wikieditor_. The default web assets are:


[webassets_common]

; path to markitup files
jforms_wikieditor_default.js[]="$jelix/markitup/jquery.markitup.js"

; path to translation files
jforms_wikieditor_default.js[]="$jelix/markitup/sets/wr3/$locale.js"

; path to a skin for MarkitUp
jforms_wikieditor_default.css[]="$jelix/markitup/skins/simple/style.css"
jforms_wikieditor_default.css[]="$jelix/markitup/sets/wr3/style.css"

; dependency of markitup: the webassets group named "jquery"
jforms_wikieditor_default.require=jquery

You could use anoter "set" supported by MarkitUp, such as markdown. You have to create an other configuration, or to modify the default one. We could named it "md", and use the CSS and JS file of this "set".


[wikieditors]
md.engine.name = markdown
md.wiki.rules = md_to_xhtml

[webassets_common]

jforms_wikieditor_md.js[]="$jelix/markitup/jquery.markitup.js"
jforms_wikieditor_md.js[]="$jelix/markitup/sets/markdown/set.js"
jforms_wikieditor_md.css[]="$jelix/markitup/skins/simple/style.css"
jforms_wikieditor_md.css[]="$jelix/markitup/sets/markdown/style.css"
jforms_wikieditor_md.require=jquery

(rules md_to_xhtml for Wikirenderer do not exist, you should create them).

Configuration into jForms

So to add a wiki editor to a form, we will write in the *.form.xml file:


<wikieditor ref="message" config="default" required="true">

where:

  • ref is the name of the textarea, here message
  • config is the config name used in the file mainconfig.ini.php
  • required if you want this textarea is mandatory