cogConverts some content in Confluence wiki markup into XWiki Syntax 2.1 markup
Developed by

Vincent Massol

0 Votes
LicenseGNU Lesser General Public License 2.1



  • Note 1: Since Confluence now uses HTML as the internal format you can use the same script to convert from HTML to XWiki Syntax
  • Note 2: XWiki supports several syntaxes natively so you don't need to convert, except that the XWik Syntax is the most complete one and can be used without loss with the XWiki WYSIWYG editor (see PageEditing).
  • Note 3: There's now a Confluence Importer
import com.xpn.xwiki.web.Utils
import org.xwiki.rendering.renderer.printer.*
import org.xwiki.rendering.converter.*
import org.xwiki.rendering.syntax.*

// Read Confluence Content (You can get it from wherever you wish: local file, web page, etc)
def content = """
h1. Biggest heading
Hello *bold* world

// Convert to XWiki 2.1 Syntax
def converter =  services.component.getInstance(Converter.class);
def printer = new DefaultWikiPrinter();
converter.convert(new StringReader(content), Syntax.CONFLUENCE_1_0, Syntax.XWIKI_2_1, printer);
def newContent = printer.toString()

// Create new Document with converted content
def newDoc = xwiki.getDocument("Main.NewDoc")

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Created by Vincent Massol on 2012/05/19 11:07

Get Connected