< Parser 2011

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

  • 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

Symbolic NameNode TypeParent Node TypesChild Node Types
paragraphLeafanynone
headingLeafanynone
listBranchanylistItem
listItemBranchlistany
tableBranchanynone
tableRowBranchtabletableCell
tableCellBranchtableRowany
horizontalRuleLeafanynone
commentLeafanynone
preLeafanynone

Annotation Types

Symbolic NameDescriptionHTML equivalentWikiText equivilant
textStyle/boldBold<b>''' '''
textStyle/italicItalic<i>'' ''
textStyle/emphasizeEmphasize<em>
textStyle/strongStrong<strong>
textStyle/bigBig<big>
textStyle/smallSmall<small>
textStyle/subScriptSub-script<sub>
textStyle/superScriptSuper-script<sup>
link/internalInternal link<a>[[ ]]
link/externalInternal link<a>[ ]
object/hookParser Hook<ref></ref>
object/templateTemplate transclusion{{ }}

Node Examples

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 } }
        ]
    }
}
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.