-
Notifications
You must be signed in to change notification settings - Fork 2
SyntaxToken (EN)
Bhsd edited this page Feb 9, 2025
·
3 revisions
All kinds of special syntax. This class inherits all the properties and methods of the Token class which are not repeated here.
✅ Available in the Mini and Browser versions.
✅ Expand
type: string
Type of the token.
// type
var {firstChild: {firstChild}} = Parser.parse('#redirect [[a]]');
assert.equal(firstChild, '#redirect ');
assert.strictEqual(firstChild.type, 'redirect-syntax');
({firstChild: {firstChild}} = Parser.parse('{{uc:a}}'));
assert.equal(firstChild, 'uc');
assert.strictEqual(firstChild.type, 'magic-word-name');
({firstChild: {firstChild}} = Parser.parse('{|'));
assert.equal(firstChild, '{|');
assert.strictEqual(firstChild.type, 'table-syntax');
✅ Expand
returns: LintError[]
Report potential grammar errors.
// lint
var {firstChild: {firstChild}} = Parser.parse('{|\n|}');
assert.equal(firstChild, '{|');
assert.deepStrictEqual(firstChild.lint(), []);
Expand
returns: this
Deep clone the node.
// cloneNode (main)
var {firstChild: {firstChild}} = Parser.parse('{|');
assert.equal(firstChild, '{|');
assert.deepStrictEqual(firstChild.cloneNode(), firstChild);
对维基文本批量执行语法检查的命令行工具
用于维基文本的 ESLint 插件
A command-line tool that performs linting on Wikitext in bulk
ESLint plugin for Wikitext