@electron/lint-roller 1.11.1 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const { addError, filterTokens } = require('markdownlint/helpers');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
names: ['EMD002', 'no-angle-brackets'],
|
|
5
|
+
description: 'No unescaped opening angle brackets in text (does not play nice with MDX)',
|
|
6
|
+
tags: ['brackets'],
|
|
7
|
+
function: function EMD002(params, onError) {
|
|
8
|
+
filterTokens(params, 'inline', (token) => {
|
|
9
|
+
for (const childToken of token.children) {
|
|
10
|
+
// childToken.line has the raw content, but may also contain
|
|
11
|
+
// more content than just childToken.content. This may cause
|
|
12
|
+
// the same line to produce multiple errors, unfortunately.
|
|
13
|
+
if (
|
|
14
|
+
childToken.type === 'text' &&
|
|
15
|
+
childToken.markup !== '<' &&
|
|
16
|
+
childToken.markup !== '<' &&
|
|
17
|
+
childToken.content.includes('<') &&
|
|
18
|
+
childToken.line.match(/(?<!\\)</g) !== null
|
|
19
|
+
) {
|
|
20
|
+
addError(onError, token.lineNumber, 'Unescaped opening angle bracket');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
};
|