@markuplint/parser-utils 5.0.0-alpha.1 → 5.0.0-alpha.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.
@@ -21,7 +21,7 @@ src/
21
21
  ├── debugger.ts — デバッグ・テスト用ユーティリティ
22
22
  ├── parser-error.ts — ParserError, TargetParserError, ConfigParserError
23
23
  ├── sort-nodes.ts — ノード位置ソート
24
- ├── const.ts — MASK_CHAR, SVG 要素リスト, defaultSpaces
24
+ ├── const.ts — MASK_CHAR, SVG/MathML 要素リスト, defaultSpaces
25
25
  ├── get-location.ts — 行/列/オフセット計算ユーティリティ
26
26
  └── decision.ts — カスタム要素名判定
27
27
  ```
@@ -99,7 +99,7 @@ flowchart TD
99
99
  | `debugger.ts` | テスト・デバッグユーティリティ | `nodeListToDebugMaps`, `attributesToDebugMaps`, `nodeTreeDebugView` |
100
100
  | `parser-error.ts` | エラークラス | `ParserError`, `TargetParserError`, `ConfigParserError` |
101
101
  | `sort-nodes.ts` | ノードの位置ソート | `sortNodes` |
102
- | `const.ts` | 定数 | `MASK_CHAR`, `svgElementList`, `defaultSpaces` |
102
+ | `const.ts` | 定数 | `MASK_CHAR`, `svgElementList`, `mathmlElementList`, `defaultSpaces` |
103
103
  | `get-location.ts` | 位置計算 | `getPosition`, `getEndLine`, `getEndCol`, `getEndPosition`, `getOffsetsFromCode` |
104
104
  | `decision.ts` | カスタム要素名判定 | `isPotentialCustomElementName`, `isSVGElement` |
105
105
 
package/ARCHITECTURE.md CHANGED
@@ -22,7 +22,7 @@ src/
22
22
  ├── debug.ts — Performance timer and debug logging via `debug` package
23
23
  ├── parser-error.ts — ParserError, TargetParserError, ConfigParserError
24
24
  ├── sort-nodes.ts — Node position sorting
25
- ├── const.ts — MASK_CHAR, SVG element list, defaultSpaces
25
+ ├── const.ts — MASK_CHAR, SVG/MathML element lists, defaultSpaces
26
26
  ├── get-location.ts — Line/column/offset calculation utilities
27
27
  └── decision.ts — Custom element name detection
28
28
  ```
@@ -59,7 +59,7 @@ flowchart TD
59
59
  parserError["parser-error.ts\nParserError hierarchy"]
60
60
  sortNodes["sort-nodes.ts\nsortNodes()"]
61
61
  getLoc["get-location.ts\ngetPosition(), getEndLine()"]
62
- constMod["const.ts\nMASK_CHAR, svgElementList"]
62
+ constMod["const.ts\nMASK_CHAR, svgElementList,\nmathmlElementList"]
63
63
  end
64
64
 
65
65
  subgraph external ["External Dependencies"]
@@ -112,9 +112,9 @@ flowchart TD
112
112
  | `debug.ts` | Performance timing and debug logging | `PerformanceTimer`, `domLog`, `log` |
113
113
  | `parser-error.ts` | Error classes with positional information | `ParserError`, `TargetParserError`, `ConfigParserError` |
114
114
  | `sort-nodes.ts` | Node position sorting by offset | `sortNodes` |
115
- | `const.ts` | Constants used across the package | `MASK_CHAR`, `svgElementList`, `defaultSpaces` |
115
+ | `const.ts` | Constants used across the package | `MASK_CHAR`, `svgElementList`, `mathmlElementList`, `defaultSpaces` |
116
116
  | `get-location.ts` | Line/column/offset position calculations | `getPosition`, `getEndLine`, `getEndCol`, `getEndPosition`, `getOffsetsFromCode` |
117
- | `decision.ts` | Custom element name detection and SVG element lookup | `isPotentialCustomElementName`, `isSVGElement` |
117
+ | `decision.ts` | Custom element name detection and SVG/MathML element lookup | `isPotentialCustomElementName`, `isSVGElement` |
118
118
 
119
119
  ## Parse Pipeline Overview
120
120
 
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.0.0-alpha.3](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.2...v5.0.0-alpha.3) (2026-02-26)
7
+
8
+ **Note:** Version bump only for package @markuplint/parser-utils
9
+
10
+ # [5.0.0-alpha.2](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.1...v5.0.0-alpha.2) (2026-02-23)
11
+
12
+ ### Features
13
+
14
+ - **parser-utils:** add MathML namespace detection ([6c27e45](https://github.com/markuplint/markuplint/commit/6c27e45475104d744a8109e8e36698bd9dba4e8b))
15
+
6
16
  # [5.0.0-alpha.1](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.0...v5.0.0-alpha.1) (2026-02-22)
7
17
 
8
18
  ### Bug Fixes
@@ -1,3 +1,4 @@
1
+ export { getPosition } from '@markuplint/shared';
1
2
  /**
2
3
  * @deprecated Use {@link getPosition} instead. Will be removed in v5.0.0.
3
4
  */
@@ -6,17 +7,6 @@ export declare function getLine(rawCodeFragment: string, startOffset: number): n
6
7
  * @deprecated Use {@link getPosition} instead. Will be removed in v5.0.0.
7
8
  */
8
9
  export declare function getCol(rawCodeFragment: string, startOffset: number): number;
9
- /**
10
- * Computes the line and column of a position within a code fragment.
11
- *
12
- * @param rawCodeFragment - The full raw source text
13
- * @param startOffset - The zero-based byte offset to compute the position of
14
- * @returns An object containing one-based `line` and `column`
15
- */
16
- export declare function getPosition(rawCodeFragment: string, startOffset: number): {
17
- readonly line: number;
18
- readonly column: number;
19
- };
20
10
  export declare function getEndLine(rawCodeFragment: string, startLine: number): number;
21
11
  export declare function getEndCol(rawCodeFragment: string, startCol: number): number;
22
12
  /**
@@ -1,3 +1,4 @@
1
+ export { getPosition } from '@markuplint/shared';
1
2
  const LINE_BREAK = '\n';
2
3
  /**
3
4
  * @deprecated Use {@link getPosition} instead. Will be removed in v5.0.0.
@@ -12,19 +13,6 @@ export function getCol(rawCodeFragment, startOffset) {
12
13
  const lines = rawCodeFragment.slice(0, startOffset).split(LINE_BREAK);
13
14
  return (lines.at(-1) ?? '').length + 1;
14
15
  }
15
- /**
16
- * Computes the line and column of a position within a code fragment.
17
- *
18
- * @param rawCodeFragment - The full raw source text
19
- * @param startOffset - The zero-based byte offset to compute the position of
20
- * @returns An object containing one-based `line` and `column`
21
- */
22
- export function getPosition(rawCodeFragment, startOffset) {
23
- const lines = rawCodeFragment.slice(0, startOffset).split(LINE_BREAK);
24
- const line = lines.length;
25
- const column = (lines.at(-1) ?? '').length + 1;
26
- return { line, column };
27
- }
28
16
  export function getEndLine(rawCodeFragment, startLine) {
29
17
  return rawCodeFragment.split(LINE_BREAK).length - 1 + startLine;
30
18
  }
@@ -25,7 +25,7 @@ function getParentNamespace(parentNode) {
25
25
  return 'http://www.w3.org/1999/xhtml';
26
26
  }
27
27
  if ('namespace' in parentNode && parentNode.namespace) {
28
- const ns = parentNode.namespace.toLowerCase().trim();
28
+ const ns = parentNode.namespace.trim();
29
29
  return ns === 'http://www.w3.org/1999/xhtml'
30
30
  ? 'http://www.w3.org/1999/xhtml'
31
31
  : ns === 'http://www.w3.org/2000/svg'
@@ -79,7 +79,7 @@ ignoreBlock, throwErrorWhenTagHasUnresolved = true) {
79
79
  childNodes: [],
80
80
  blockBehavior: null,
81
81
  isBogus: false,
82
- isFragment: false, // TODO: Case by case
82
+ isFragment: false, // Whether this block is a fragment depends on the preprocessor directive type, but defaults to false as a safe assumption for ignore-block replacements.
83
83
  };
84
84
  replacementChildNodes.push(psNode);
85
85
  }
@@ -110,7 +110,7 @@ ignoreBlock, throwErrorWhenTagHasUnresolved = true) {
110
110
  childNodes: [],
111
111
  blockBehavior: null,
112
112
  isBogus: false,
113
- isFragment: false, // TODO: Case by case
113
+ isFragment: false, // Whether this block is a fragment depends on the preprocessor directive type, but defaults to false as a safe assumption for ignore-block replacements.
114
114
  };
115
115
  replacementChildNodes.push(psNode);
116
116
  if (below) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/parser-utils",
3
- "version": "5.0.0-alpha.1",
3
+ "version": "5.0.0-alpha.3",
4
4
  "description": "Utility module for markuplint parser plugin",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -31,15 +31,16 @@
31
31
  "clean": "tsc --build --clean tsconfig.build.json"
32
32
  },
33
33
  "dependencies": {
34
- "@markuplint/ml-ast": "5.0.0-alpha.1",
35
- "@markuplint/ml-spec": "5.0.0-alpha.1",
36
- "@markuplint/types": "5.0.0-alpha.1",
34
+ "@markuplint/ml-ast": "5.0.0-alpha.3",
35
+ "@markuplint/ml-spec": "5.0.0-alpha.3",
36
+ "@markuplint/shared": "5.0.0-alpha.3",
37
+ "@markuplint/types": "5.0.0-alpha.3",
37
38
  "debug": "4.4.3",
38
39
  "espree": "11.1.1",
39
40
  "type-fest": "5.4.4"
40
41
  },
41
42
  "devDependencies": {
42
- "@typescript-eslint/typescript-estree": "8.56.0"
43
+ "@typescript-eslint/typescript-estree": "8.56.1"
43
44
  },
44
- "gitHead": "78a295e73a097a1ce09c777c06fa21ab68136387"
45
+ "gitHead": "2fbdf26daa3d021ac628ccc2f59f0eeae6ddd53d"
45
46
  }