Skip to content

Multilayered inline elements becomes "text" #15

Closed
@YusukeHirao

Description

@YusukeHirao
module version
textlint 11.6.1
textlint-plugin-html 0.2.0
textlint-rule-max-appearence-count-of-words 1.0.1

Spec: macOS 10.15.1, Node.js v12.13.0

const engine = new TextLintEngine({ plugins: ['html'], rules: ['max-appearence-count-of-words'] });
const results = await engine.executeOnText(
	`<html>
<head><title>テスト</title></head>
<body>
<p><span>こんにちは、世界。</span></p>
<p><span><span>こんにちは、</span><span>世界。</span></span></p>
</body>
</html>`,
	'.html',
);
const reports = results.map(r => r.messages).flat();
console.log(reports);
// ↓ Log
// {
//   type: 'lint',
//   ruleId: 'max-appearence-count-of-words',
//   message: '>< appears over 4 count in Paragraph 2',
//   index: 76,
//   line: 5,
//   column: 1,
//   severity: 2,
//   fix: undefined
// }
// {
//   type: 'lint',
//   ruleId: 'max-appearence-count-of-words',
//   message: 'span appears over 4 count in Paragraph 2',
//   index: 76,
//   line: 5,
//   column: 1,
//   severity: 2,
//   fix: undefined
// }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions