@markuplint/ml-core 4.0.2 → 4.0.3

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.
@@ -2097,6 +2097,9 @@ export class MLDocument extends MLParentNode {
2097
2097
  let offset = 0;
2098
2098
  for (const node of this.getTokenList()) {
2099
2099
  const nodeRaw = node.toString(true);
2100
+ if (nodeRaw === node.raw) {
2101
+ continue;
2102
+ }
2100
2103
  raw = raw.slice(0, node.startOffset + offset) + nodeRaw + raw.slice(node.endOffset + offset);
2101
2104
  offset += nodeRaw.length - (node.endOffset - node.startOffset);
2102
2105
  }
@@ -26,6 +26,9 @@ export class MLElementCloseTag extends MLNode {
26
26
  if (!fixed) {
27
27
  return this.raw;
28
28
  }
29
+ if (this.nodeName.startsWith('#')) {
30
+ return this.raw;
31
+ }
29
32
  if (this.pair.isOmitted) {
30
33
  return this.raw;
31
34
  }
@@ -2756,12 +2756,19 @@ export class MLElement extends MLParentNode {
2756
2756
  }
2757
2757
  let raw = this.raw;
2758
2758
  let offset = 0;
2759
+ const overlayedCommentNodes = this.ownerMLDocument.nodeList.filter(node => {
2760
+ if (node.is(node.COMMENT_NODE)) {
2761
+ return this.startOffset < node.startOffset && node.endOffset < this.endOffset;
2762
+ }
2763
+ return false;
2764
+ });
2759
2765
  const nodes = [
2760
2766
  {
2761
2767
  toString: () => this.tagOpenChar + this.fixedNodeName,
2762
2768
  startOffset: this.startOffset,
2763
2769
  endOffset: this.startOffset + this.tagOpenChar.length + this.nodeName.length,
2764
2770
  },
2771
+ ...overlayedCommentNodes,
2765
2772
  ...this.attributes,
2766
2773
  ];
2767
2774
  for (const node of nodes) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/ml-core",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "description": "The core module of markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -29,18 +29,18 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@markuplint/config-presets": "4.0.1",
32
- "@markuplint/html-parser": "4.0.0",
33
- "@markuplint/html-spec": "4.0.1",
34
- "@markuplint/i18n": "4.0.0",
35
- "@markuplint/ml-ast": "4.0.0",
36
- "@markuplint/ml-config": "4.0.0",
37
- "@markuplint/ml-spec": "4.0.0",
38
- "@markuplint/parser-utils": "4.0.0",
39
- "@markuplint/selector": "4.0.0",
32
+ "@markuplint/html-parser": "4.0.1",
33
+ "@markuplint/html-spec": "4.0.2",
34
+ "@markuplint/i18n": "4.0.1",
35
+ "@markuplint/ml-ast": "4.0.1",
36
+ "@markuplint/ml-config": "4.0.1",
37
+ "@markuplint/ml-spec": "4.0.1",
38
+ "@markuplint/parser-utils": "4.0.1",
39
+ "@markuplint/selector": "4.0.1",
40
40
  "@types/debug": "^4.1.12",
41
41
  "debug": "^4.3.4",
42
42
  "is-plain-object": "^5.0.0",
43
43
  "type-fest": "^4.10.2"
44
44
  },
45
- "gitHead": "b21d44dd0ac6b0e8be0201b92062e4b115fbc880"
45
+ "gitHead": "bf84b391b580a8586fa7acaf56eb2e8114c8e33e"
46
46
  }