HTML Variants Syntaxes

Last modified by Michael Hamann on 2022/02/08 16:54

This page gathers the documentation about the HTML variants syntaxes and their specificities.

Annotated XHTML

This syntax puts supplementary information in the rendered XHTML in order to be used by the CKEditor.

Metadata Annotation

Metadata provided in the page structure (XDOM) are now output when using the Annotated XHTML renderer, using the following rules:

  • it produces a container with the class xwiki-metadata-container
  • the container is a div or a span depending if the metadata is an inline context or not
  • all metadata are provided in dedicated attribute named on the schema data-xwiki-key where key is the metadata name.

Then the following XDOM: 

beginMetaData [[syntax]=[xwiki/2.0]]
onWord [Heading]
endMetaData [[syntax]=[xwiki/2.0]]

will be interpreted like this:

<div class="xwiki-metadata-container" data-xwiki-syntax="xwiki/2.0">

Macro Annotation

Macros are annotated by HTML comments that allow reconstructing the original content.  The content between them can further be wrapped in metadata blocks to mark the content as non-generated with the goal of allowing editing of the content in the WYSIWYG editor. The following XDOM:

beginMacroMarkerStandalone [testinlineeditingmacro] [] [Some content]
beginMetaData [[non-generated-content]=[java.util.List<org.xwiki.rendering.block.Block>]]
onWord [Some content]
endMetaData [[non-generated-content]=[java.util.List<org.xwiki.rendering.block.Block>]]
endMacroMarkerStandalone [testinlineeditingmacro] [] [Some content]

 will be interpreted as:

<!--startmacro:testinlineeditingmacro|-||-|Some content-->
<div data-xwiki-non-generated-content="java.util.List&lt;org.xwiki.rendering.block.Block&gt;" class="xwiki-metadata-container">
 <p>Some content</p>

Note that the full content of the macro is contained in the HTML comment. If there is no non-generated content, the HTML code between the comments will be ignored during parsing.

Annotated HTML5

Since XWiki 14.0, Annotated HTML 5 uses the same metadata and macro markers as annotated XHTML 1.0, before that some parts were missing, see Note that the `data-`-attributes used for metadata are actually only valid in HTML 5 and thus annotated HTML 5 should be preferred whenever possible. With the availability of a (X)HTML 5 parsers in XWiki 14.1 (see, this should always be possible unless backwards-compatibility needs to be maintained.

  • Powered by XWiki 15.10.8-node2. Hosted and managed by XWiki SAS

Get Connected