Skip to content

RedirectTargetToken (EN)

bhsd edited this page Jun 18, 2024 · 3 revisions

Other Languages

Introduction

The target of redirect. RedirectTargetToken inherits all the properties and methods of the LinkBaseToken class which are not repeated here.

✅ Available in the Mini and Browser versions.

Properties

type

✅ Expand

type: 'redirect-target'

// type
var {firstChild: {lastChild}} = Parser.parse('#redirect [[a]]');
assert.equal(lastChild, '[[a]]');
assert.strictEqual(lastChild.type, 'redirect-target');

Methods

lint

✅ Expand

returns: LintError[]
Report potential grammar errors.

// lint
var {firstChild: {lastChild}} = Parser.parse('#redirect [[a|b]]');
assert.equal(lastChild, '[[a|b]]');
assert.deepStrictEqual(lastChild.lint(), [
	{
		rule: 'no-ignored',
		severity: 'error',
		message: 'useless link text',
		startLine: 0,
		startCol: 13,
		startIndex: 13,
		endLine: 0,
		endCol: 15,
		endIndex: 15,
		fix: {
			range: [13, 15],
			text: '',
		},
	},
]);

cloneNode

Expand

param: this
Deep clone the node.

// cloneNode (main)
var {firstChild: {lastChild}} = Parser.parse('#redirect [[a|b]]');
assert.equal(lastChild, '[[a|b]]');
assert.deepStrictEqual(lastChild.cloneNode(), lastChild);
Clone this wiki locally