Skip to content

QuoteToken

Bhsd edited this page Dec 6, 2024 · 11 revisions

Other Languages

简介

单引号(斜体或粗体)。

✅ 在 MiniBrowser 版本中可用。

Properties

bold

✅ 展开

加入的版本:1.3.9

type: boolean
是否粗体。

// bold
var {firstChild} = Parser.parse("'''");
assert(firstChild.bold);

italic

✅ 展开

加入的版本:1.3.9

type: boolean
是否斜体。

// italic
var {firstChild} = Parser.parse("''");
assert(firstChild.italic);

Methods

lint

✅ 展开

returns: LintError[]
报告潜在语法错误。

// lint
var {firstChild: {firstChild: {lastChild}}} = Parser.parse("==''''==");
assert.equal(lastChild, "'''");
assert.deepStrictEqual(lastChild.lint(), [
	{
		rule: 'lonely-apos',
		severity: 'error',
		message: `lonely "'"`,
		startLine: 0,
		startCol: 2,
		startIndex: 2,
		endLine: 0,
		endCol: 3,
		endIndex: 3,
		suggestions: [
			{
				desc: 'escape',
				range: [2, 3],
				text: ''',
			},
			{
				desc: 'remove',
				range: [2, 3],
				text: '',
			},
		],
	},
	{
		rule: 'bold-header',
		severity: 'warning',
		message: 'bold in section header',
		startLine: 0,
		startCol: 3,
		startIndex: 3,
		endLine: 0,
		endCol: 6,
		endIndex: 6,
		suggestions: [
			{
				desc: 'remove',
				range: [3, 6],
				text: '',
			},
		],
	},
]);

cloneNode

展开

returns: this
深拷贝节点。

// cloneNode (main)
var {firstChild} = Parser.parse("''");
assert.deepStrictEqual(firstChild.cloneNode(), firstChild);
Clone this wiki locally