@markuplint/parser-utils
Advanced tools
Comparing version 4.0.0-alpha.6 to 4.0.0-alpha.7
@@ -14,4 +14,5 @@ export declare const MASK_CHAR = "\uE000"; | ||
* - U+000C FORM FEED (FF) => `\f` | ||
* - U+000D CARRIAGE RETURN (CR) => `\r` | ||
* - U+0020 SPACE => ` ` | ||
*/ | ||
export declare const defaultSpaces: readonly ["\t", "\n", "\f", " "]; | ||
export declare const defaultSpaces: readonly ["\t", "\n", "\f", "\r", " "]; |
@@ -103,4 +103,5 @@ export const MASK_CHAR = '\uE000'; | ||
* - U+000C FORM FEED (FF) => `\f` | ||
* - U+000D CARRIAGE RETURN (CR) => `\r` | ||
* - U+0020 SPACE => ` ` | ||
*/ | ||
export const defaultSpaces = ['\t', '\n', '\f', ' ']; | ||
export const defaultSpaces = ['\t', '\n', '\f', '\r', ' ']; |
@@ -68,2 +68,40 @@ import { MASK_CHAR } from './const.js'; | ||
const { source, stack, maskChar } = ignoreBlock; | ||
for (const tag of stack) { | ||
const node = nodeList.find(node => node.startOffset === tag.index); | ||
if (!node) { | ||
continue; | ||
} | ||
if (node.type !== 'comment') { | ||
continue; | ||
} | ||
const psNode = { | ||
uuid: uuid(), | ||
type: 'psblock', | ||
nodeName: `#ps:${tag.type}`, | ||
raw: `${tag.startTag}${tag.taggedCode}${tag.endTag ?? ''}`, | ||
parentNode: node.parentNode, | ||
prevNode: null, | ||
nextNode: null, | ||
isFragment: node.isFragment, | ||
isGhost: false, | ||
startOffset: node.startOffset, | ||
endOffset: node.endOffset, | ||
startLine: node.startLine, | ||
endLine: node.endLine, | ||
startCol: node.startCol, | ||
endCol: node.endCol, | ||
}; | ||
if (node.prevNode?.nextNode) { | ||
node.prevNode.nextNode = psNode; | ||
} | ||
if (node.nextNode?.prevNode) { | ||
node.nextNode.prevNode = psNode; | ||
} | ||
if (node.parentNode?.childNodes) { | ||
const index = node.parentNode.childNodes.indexOf(node); | ||
node.parentNode.childNodes.splice(index, 1, psNode); | ||
} | ||
const index = nodeList.indexOf(node); | ||
nodeList.splice(index, 1, psNode); | ||
} | ||
for (const node of nodeList) { | ||
@@ -70,0 +108,0 @@ if (node.type === 'comment' || node.type === 'text' || node.type === 'psblock') { |
{ | ||
"name": "@markuplint/parser-utils", | ||
"version": "4.0.0-alpha.6", | ||
"version": "4.0.0-alpha.7", | ||
"description": "Utility module for markuplint parser plugin", | ||
@@ -27,10 +27,10 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"dependencies": { | ||
"@markuplint/ml-ast": "4.0.0-alpha.6", | ||
"@markuplint/types": "4.0.0-alpha.6", | ||
"@markuplint/ml-ast": "4.0.0-alpha.7", | ||
"@markuplint/types": "4.0.0-alpha.7", | ||
"@types/uuid": "^9.0.7", | ||
"espree": "^9.6.1", | ||
"type-fest": "^4.8.2", | ||
"type-fest": "^4.9.0", | ||
"uuid": "^9.0.1" | ||
}, | ||
"gitHead": "06e1242d274c72cf08a10a572b06ac35d1b924a4" | ||
"gitHead": "571129bf6498541125e1e7c3907d5ed9af53459a" | ||
} |
Sorry, the diff of this file is not supported yet
78493
2249
+ Added@markuplint/ml-ast@4.0.0-alpha.7(transitive)
+ Added@markuplint/types@4.0.0-alpha.7(transitive)
- Removed@markuplint/ml-ast@4.0.0-alpha.6(transitive)
- Removed@markuplint/types@4.0.0-alpha.6(transitive)
Updatedtype-fest@^4.9.0