@markuplint/parser-utils
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -1,1 +0,2 @@ | ||
export declare const MASK_CHAR = '\uE000'; | ||
export declare const MASK_CHAR = "\uE000"; | ||
export declare const rePCEN: RegExp; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MASK_CHAR = void 0; | ||
exports.rePCEN = exports.MASK_CHAR = void 0; | ||
exports.MASK_CHAR = '\uE000'; | ||
/** | ||
* PotentialCustomElementName | ||
* | ||
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#prod-potentialcustomelementname | ||
* | ||
* > PotentialCustomElementName ::= | ||
* > [a-z] (PCENChar)* '-' (PCENChar)* | ||
* > PCENChar ::= | ||
* > "-" | "." | [0-9] | "_" | [a-z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] | | ||
* > [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] | ||
* > This uses the EBNF notation from the XML specification. [XML] | ||
* | ||
* ASCII-case-insensitively. | ||
* Originally, it is not possible to define a name including ASCII upper alphas in the custom element, but it is not treated as illegal by the HTML parser. | ||
*/ | ||
const rePCENChar = [ | ||
'\\-', | ||
'\\.', | ||
'[0-9]', | ||
'_', | ||
'[a-z]', | ||
'\u00B7', | ||
'[\u00C0-\u00D6]', | ||
'[\u00D8-\u00F6]', | ||
'[\u00F8-\u037D]', | ||
'[\u037F-\u1FFF]', | ||
'[\u200C-\u200D]', | ||
'[\u203F-\u2040]', | ||
'[\u2070-\u218F]', | ||
'[\u2C00-\u2FEF]', | ||
'[\u3001-\uD7FF]', | ||
'[\uF900-\uFDCF]', | ||
'[\uFDF0-\uFFFD]', | ||
'[\uD800-\uDBFF][\uDC00-\uDFFF]', | ||
].join('|'); | ||
exports.rePCEN = new RegExp(`^[a-z](?:${rePCENChar})*\\-(?:${rePCENChar})*$`, 'i'); |
export declare type Code = { | ||
type: string; | ||
index: number; | ||
startTag: string; | ||
taggedCode: string; | ||
endTag: string | null; | ||
type: string; | ||
index: number; | ||
startTag: string; | ||
taggedCode: string; | ||
endTag: string | null; | ||
}; | ||
export declare type IgnoreTag = { | ||
type: string; | ||
start: RegExp; | ||
end: RegExp; | ||
type: string; | ||
start: RegExp; | ||
end: RegExp; | ||
}; | ||
export declare type IgnoreBlock = { | ||
source: string; | ||
replaced: string; | ||
stack: Code[]; | ||
source: string; | ||
replaced: string; | ||
stack: Code[]; | ||
}; |
@@ -21,1 +21,23 @@ import { MLASTAttr, MLASTNode, MLToken, Walker } from '@markuplint/ml-ast'; | ||
export declare function siblingsCorrection(nodeList: MLASTNode[]): void; | ||
/** | ||
* valid name of custom element | ||
* | ||
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name | ||
* | ||
* > - name must match the [PotentialCustomElementName](https://html.spec.whatwg.org/multipage/custom-elements.html#prod-potentialcustomelementname) production | ||
* > - name must not be any of the following: | ||
* > - annotation-xml | ||
* > - color-profile | ||
* > - font-face | ||
* > - font-face-src | ||
* > - font-face-uri | ||
* > - font-face-format | ||
* > - font-face-name | ||
* > - missing-glyph | ||
* | ||
* ASCII-case-insensitively. | ||
* Originally, it is not possible to define a name including ASCII upper alphas in the custom element, but it is not treated as illegal by the HTML parser. | ||
* | ||
* @param tagName | ||
*/ | ||
export declare function isPotentialCustomElementName(tagName: string): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.siblingsCorrection = exports.attributesToDebugMaps = exports.nodeListToDebugMaps = exports.walk = exports.getEndCol = exports.getEndLine = exports.getCol = exports.getLine = exports.sliceFragment = exports.tokenizer = exports.uuid = void 0; | ||
exports.isPotentialCustomElementName = exports.siblingsCorrection = exports.attributesToDebugMaps = exports.nodeListToDebugMaps = exports.walk = exports.getEndCol = exports.getEndLine = exports.getCol = exports.getLine = exports.sliceFragment = exports.tokenizer = exports.uuid = void 0; | ||
const ml_ast_1 = require("@markuplint/ml-ast"); | ||
const const_1 = require("./const"); | ||
const uuid_1 = require("uuid"); | ||
@@ -126,2 +127,39 @@ function uuid() { | ||
exports.siblingsCorrection = siblingsCorrection; | ||
/** | ||
* valid name of custom element | ||
* | ||
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name | ||
* | ||
* > - name must match the [PotentialCustomElementName](https://html.spec.whatwg.org/multipage/custom-elements.html#prod-potentialcustomelementname) production | ||
* > - name must not be any of the following: | ||
* > - annotation-xml | ||
* > - color-profile | ||
* > - font-face | ||
* > - font-face-src | ||
* > - font-face-uri | ||
* > - font-face-format | ||
* > - font-face-name | ||
* > - missing-glyph | ||
* | ||
* ASCII-case-insensitively. | ||
* Originally, it is not possible to define a name including ASCII upper alphas in the custom element, but it is not treated as illegal by the HTML parser. | ||
* | ||
* @param tagName | ||
*/ | ||
function isPotentialCustomElementName(tagName) { | ||
switch (tagName) { | ||
case 'annotation-xml': | ||
case 'color-profile': | ||
case 'font-face': | ||
case 'font-face-src': | ||
case 'font-face-uri': | ||
case 'font-face-format': | ||
case 'font-face-name': | ||
case 'missing-glyph': { | ||
return false; | ||
} | ||
} | ||
return const_1.rePCEN.test(tagName); | ||
} | ||
exports.isPotentialCustomElementName = isPotentialCustomElementName; | ||
function tokenDebug(n, type = '') { | ||
@@ -128,0 +166,0 @@ return `[${n.startLine}:${n.startCol}]>[${n.endLine}:${n.endCol}](${n.startOffset},${n.endOffset})${n.nodeName || n.potentialName || n.name || n.type || type}: ${visibleWhiteSpace(n.raw)}`; |
{ | ||
"name": "@markuplint/parser-utils", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Utility module for markuplint parser plugin", | ||
@@ -22,6 +22,6 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"dependencies": { | ||
"@markuplint/ml-ast": "^1.4.0", | ||
"@markuplint/ml-ast": "^1.4.1", | ||
"uuid": "^8.3.2" | ||
}, | ||
"gitHead": "b0b90e206a61e48edfcad573f19f1a9df8460eb4" | ||
"gitHead": "46a4a218a03ff25750386d3d6d7e184bbef8b046" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171164
563
Updated@markuplint/ml-ast@^1.4.1