-
Notifications
You must be signed in to change notification settings - Fork 2
ExtLinkToken (EN)
bhsd edited this page Jun 26, 2024
·
6 revisions
External link wrapped by []
. This class mixes the properties and methods of the MagicLinkToken class.
All of the following properties and methods are not available in the Mini and Browser versions.
type: string
Display text of the external link.
// innerText (main)
var {firstChild, lastChild} = Parser.parse('[//a][//b bb]');
assert.equal(firstChild, '[//a]');
assert.equal(lastChild, '[//b bb]');
assert.strictEqual(firstChild.innerText, '[1]');
assert.strictEqual(lastChild.innerText, 'bb');
firstChild.innerText = 'a';
assert.equal(firstChild, '[//a a]');
returns: this
Deep clone the node.
// cloneNode (main)
var {firstChild} = Parser.parse('[//a b]');
assert.deepStrictEqual(firstChild.cloneNode(), firstChild);
param: string
display text
Set the display text of the external link.
// setLinkText (main)
var {firstChild} = Parser.parse('[//a]');
firstChild.setLinkText('a');
assert.equal(firstChild, '[//a a]');
version added: 1.10.0
returns: string
Convert to HTML.
// toHtml (main)
var {firstChild, lastChild} = Parser.parse('[//a][news:b b ]');
assert.equal(firstChild, '[//a]');
assert.equal(lastChild, '[news:b b ]');
assert.strictEqual(
firstChild.toHtml(),
`<a class="external" rel="nofollow" href="https://a/">[1]</a>`,
);
assert.strictEqual(
lastChild.toHtml(),
`<a class="external" rel="nofollow" href="news:b">b </a>`,
);
对维基文本批量执行语法检查的命令行工具
用于维基文本的 ESLint 插件
A command-line tool that performs linting on Wikitext in bulk
ESLint plugin for Wikitext