-
Notifications
You must be signed in to change notification settings - Fork 2
ExtToken
bhsd edited this page Nov 24, 2023
·
22 revisions
扩展标签。这个类同时混合了 AttributesToken 类的方法。
- 是否自封闭。
var root = Parser.parse('<ref/>'),
ref = root.firstChild;
assert(ref.selfClosing === true);
- 小写的标签名。
var root = Parser.parse('<REF/>'),
ref = root.firstChild;
assert.strictEqual(ref.name, 'ref');
- 标签内部可见文本。
var root = Parser.parse('<pre id="pre"><!-- --></pre><poem class="poem"><!-- --></poem>'),
[pre, poem] = root.children;
assert.strictEqual(pre.innerText, '<!-- -->');
assert.strictEqual(poem.innerText, '');
clientHeight: number
clientWidth: number
- 标签内部可见文本的行高和最后一行的列宽,参见IncludeToken。
<gallery>
扩展标签内部。
insertImage(file: string, i: number): GalleryImageToken
- 插入一张图片。
var root = Parser.parse('<gallery>a.jpg</gallery>'),
gallery = root.querySelector('ext-inner#gallery');
gallery.insertImage('b.png', 0);
assert.strictEqual(root.toString(), '<gallery>b.png\na.jpg</gallery>');
对维基文本批量执行语法检查的命令行工具
用于维基文本的 ESLint 插件
A command-line tool that performs linting on Wikitext in bulk
ESLint plugin for Wikitext