Parser 2011/WikiDom Specification

WikiDom is a serialization of Wikitext based on JSON and optimized for transport and adaptive processing. The structure is based on two basic types of nodes, branches and leafs. Branch nodes have child nodes and leaf nodes have content. A node can not be a branch and a leaf. Content objects in leaf nodes use offset annotations for formatting.

Object Types

edit
  • Branch Node
    • type
    • attributes
    • children (branch/leaf nodes)
  • Leaf Node
    • type
    • attributes
    • content
  • Content
    • text
    • annotations
  • Annotation
    • type
    • range
    • data
  • Range
    • start
    • end

Node Types

edit
Symbolic Name Node Type Parent Node Types Child Node Types
paragraph Leaf any none
heading Leaf any none
list Branch any listItem
listItem Branch list any
table Branch any none
tableRow Branch table tableCell
tableCell Branch tableRow any
horizontalRule Leaf any none
comment Leaf any none
pre Leaf any none

Annotation Types

edit
Symbolic Name Description HTML equivalent WikiText equivilant
textStyle/bold Bold <b> ''' '''
textStyle/italic Italic <i> '' ''
textStyle/emphasize Emphasize <em>
textStyle/strong Strong <strong>
textStyle/big Big <big>
textStyle/small Small <small>
textStyle/subScript Sub-script <sub>
textStyle/superScript Super-script <sup>
link/internal Internal link <a> [[ ]]
link/external Internal link <a> [ ]
object/hook Parser Hook <ref></ref>
object/template Template transclusion {{ }}

Node Examples

edit
Table
{
    'type': 'table',
    'attributes': {
        'html/class': 'wikitable',
        'html/width': '300'
    }
    'children': [
        {
            'type': 'tableRow',
            'children': [
                {
                    'type': 'tableCell',
                    'attributes': {
                        'html/style': 'background-color: red',
                    }
                    'children': [/* ... */]
                }
            ]
        }
    ]
}
Paragraph
{
    'type': 'paragraph',
    'content': {
        'text': 'test 123',
        'annotations': [
            { 'type': 'textStyle/bold', 'range': { 'start': 0, 'end': 4 } }
        ]
    }
}