-
Notifications
You must be signed in to change notification settings - Fork 3
Examples (table)
Bhsd edited this page Apr 15, 2026
·
5 revisions
Expand
You can remove bolding from section headers in the content of a page. This example demonstrates the use of TableToken.
// Making a table sortable (main)
// The content of a page containing a table
var content = `{| class="wikitable"
! Word
|-
| Foo
|-
| Bar
|}`,
root = Parser.parse(content),
table = root.querySelector('table');
if (table) {
table.classList.add('sortable');
}
assert.equal(
root,
`{| class="wikitable sortable"
! Word
|-
| Foo
|-
| Bar
|}`,
);Expand
You can add a row to a table in the content of a page. This example demonstrates the use of TableToken and TdToken.innerText.
// Adding a row to a table (main)
// The content of a page containing a table
var content = `{|
! Rank !! Word
|-
| 1 | Foo
|-
| 2 | Bar
|}`,
root = Parser.parse(content),
table = root.querySelector('table'),
rowCount = table?.getRowCount();
if (table) {
// Insert an empty row at the end of the table
table.insertTableRow(rowCount, undefined, '');
table.getNthCell({row: rowCount, column: 0}).innerText = '3';
table.getNthCell({row: rowCount, column: 1}).innerText = 'Baz';
}
assert.equal(
root,
`{|
! Rank !! Word
|-
| 1 | Foo
|-
| 2 | Bar
|-
|3
|Baz
|}`,
);对维基文本批量执行语法检查的命令行工具
轻量级的维基模板解析器
维基文本语言服务器协议实现
用于维基文本的 VS Code 扩展
A command-line tool that performs linting on Wikitext in bulk
A lightweight Wikitext template parser
An implementation of the Language Server Protocol for Wikitext
VS Code extension for Wikitext