diff --git a/docs/user-guide/rules/spec-char-escape.md b/docs/user-guide/rules/spec-char-escape.md index b94658651..67ed84bcb 100644 --- a/docs/user-guide/rules/spec-char-escape.md +++ b/docs/user-guide/rules/spec-char-escape.md @@ -12,11 +12,13 @@ Level: `error` 1. true: enable rule 2. false: disable rule -The following pattern are **not** considered violations: +The following patterns are **not** considered violations: ```html aaa>bbb<ccc +Steinway & Sons, Q&A +Steinway & Sons, Q&A ``` The following pattern is considered violation: diff --git a/src/core/rules/spec-char-escape.ts b/src/core/rules/spec-char-escape.ts index de1601662..305657c41 100644 --- a/src/core/rules/spec-char-escape.ts +++ b/src/core/rules/spec-char-escape.ts @@ -7,7 +7,7 @@ export default { parser.addListener('text', (event) => { const raw = event.raw // TODO: improve use-cases for & - const reSpecChar = /([<>])|( \& )/g + const reSpecChar = /([<>])/g let match while ((match = reSpecChar.exec(raw))) { diff --git a/test/rules/spec-char-escape.spec.js b/test/rules/spec-char-escape.spec.js index b1f883537..cd8c5f674 100644 --- a/test/rules/spec-char-escape.spec.js +++ b/test/rules/spec-char-escape.spec.js @@ -21,13 +21,10 @@ describe(`Rules: ${ruleId}`, () => { expect(messages[2].col).toBe(4) }) - it('Special characters: & should result in an error', () => { - const code = '
Steinway & Sons
' + it('Special characters: normal & should not result in an error', () => { + const code = 'Steinway & Sons Q&A
' const messages = HTMLHint.verify(code, ruleOptions) - expect(messages.length).toBe(1) - expect(messages[0].rule.id).toBe(ruleId) - expect(messages[0].line).toBe(1) - expect(messages[0].col).toBe(12) + expect(messages.length).toBe(0) }) it('Normal text should not result in an error', () => {