Parser 2011/WikiDom Specification
(Redirected from VisualEditor/WikiDom Specification)
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. This model has been replaced by HTML5 DOM with RDFa in December 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
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
editSymbolic 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
editSymbolic 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 } }
]
}
}