@gmb/bitmark-parser-generator 5.27.0 → 5.29.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.
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <title>@gmb/bitmark-parser-generator [16 Jun 2026 at 20:53]</title>
6
+ <title>@gmb/bitmark-parser-generator [28 Jun 2026 at 23:56]</title>
7
7
  <link
8
8
  rel="shortcut icon"
9
9
  href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII="
@@ -86,7 +86,7 @@ function(){var e="function"==typeof Object.defineProperties?Object.definePropert
86
86
  <body>
87
87
  <div id="app"></div>
88
88
  <script>
89
- window.chartData = [{"label":"bitmark-parser-generator.min.js","isAsset":true,"statSize":1462711,"parsedSize":642933,"gzipSize":121581,"groups":[{"label":"dist/browser/cjs","path":"./dist/browser/cjs","statSize":1456649,"groups":[{"id":922,"label":"index.cjs","path":"./dist/browser/cjs/index.cjs","statSize":1456649,"parsedSize":642820,"gzipSize":121581}],"parsedSize":642820,"gzipSize":121581},{"label":"node_modules/@ncoderz/superenum/dist","path":"./node_modules/@ncoderz/superenum/dist","statSize":6062,"groups":[{"id":722,"label":"index.cjs","path":"./node_modules/@ncoderz/superenum/dist/index.cjs","statSize":6062}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"main":true}}];
89
+ window.chartData = [{"label":"bitmark-parser-generator.min.js","isAsset":true,"statSize":1469753,"parsedSize":646603,"gzipSize":122632,"groups":[{"label":"dist/browser/cjs","path":"./dist/browser/cjs","statSize":1463691,"groups":[{"id":922,"label":"index.cjs","path":"./dist/browser/cjs/index.cjs","statSize":1463691,"parsedSize":646490,"gzipSize":122632}],"parsedSize":646490,"gzipSize":122632},{"label":"node_modules/@ncoderz/superenum/dist","path":"./node_modules/@ncoderz/superenum/dist","statSize":6062,"groups":[{"id":722,"label":"index.cjs","path":"./node_modules/@ncoderz/superenum/dist/index.cjs","statSize":6062}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"main":true}}];
90
90
  window.entrypoints = ["main"];
91
91
  window.defaultSizes = "stat";
92
92
  window.compressionAlgorithm = "gzip";
@@ -1355,6 +1355,7 @@ var propertyKeys = {
1355
1355
  property_bubbleTag: "@bubbleTag",
1356
1356
  property_extractorTag: "@extractorTag",
1357
1357
  property_extractorInternal: "@extractorInternal",
1358
+ property_bitFingerprint: "@bitFingerprint",
1358
1359
  property_buttonCaption: "@buttonCaption",
1359
1360
  property_callToActionUrl: "@callToActionUrl",
1360
1361
  property_caption: "@caption",
@@ -1416,6 +1417,8 @@ var propertyKeys = {
1416
1417
  property_externalLinkText: "@externalLinkText",
1417
1418
  property_feedbackEngine: "@feedbackEngine",
1418
1419
  property_feedbackType: "@feedbackType",
1420
+ property_userFeedbackTranslationUrl: "@userFeedbackTranslationUrl",
1421
+ property_userFeedbackContentUrl: "@userFeedbackContentUrl",
1419
1422
  property_flashcardSet: "@flashcardSet",
1420
1423
  property_focusX: "@focusX",
1421
1424
  property_focusY: "@focusY",
@@ -3880,16 +3883,25 @@ var CARDSETS = {
3880
3883
  },
3881
3884
  {
3882
3885
  key: ConfigKey.property_tableRowSpan,
3886
+ // HTML-C2: contribute a `rowspan` attribute onto the enclosing
3887
+ // cell element (`<th>`/`<td>`).
3888
+ htmlKey: { "@el": { "@attr": { rowspan: "$" } } },
3883
3889
  description: "Number of rows the cell spans.",
3884
3890
  format: TagFormat.number
3885
3891
  },
3886
3892
  {
3887
3893
  key: ConfigKey.property_tableColSpan,
3894
+ // HTML-C2: contribute a `colspan` attribute onto the enclosing
3895
+ // cell element (`<th>`/`<td>`).
3896
+ htmlKey: { "@el": { "@attr": { colspan: "$" } } },
3888
3897
  description: "Number of columns the cell spans.",
3889
3898
  format: TagFormat.number
3890
3899
  },
3891
3900
  {
3892
3901
  key: ConfigKey.property_tableScope,
3902
+ // HTML-C2: contribute a `scope` attribute onto the enclosing
3903
+ // cell element (`<th>`/`<td>`).
3904
+ htmlKey: { "@el": { "@attr": { scope: "$" } } },
3893
3905
  description: "Scope attribute for header cells.",
3894
3906
  format: TagFormat.plainText
3895
3907
  },
@@ -4007,6 +4019,9 @@ var CARDSETS = {
4007
4019
  key: ConfigKey.property_tableRowSpan,
4008
4020
  jsonKey: "rowspan",
4009
4021
  exportJsonKey: { rowspan: "$" },
4022
+ // HTML-C2: contribute a `rowspan` attribute onto the enclosing
4023
+ // cell element (`<th>`/`<td>`).
4024
+ htmlKey: { "@el": { "@attr": { rowspan: "$" } } },
4010
4025
  description: "Number of rows the cell spans.",
4011
4026
  format: TagFormat.number
4012
4027
  },
@@ -4014,6 +4029,9 @@ var CARDSETS = {
4014
4029
  key: ConfigKey.property_tableColSpan,
4015
4030
  jsonKey: "colspan",
4016
4031
  exportJsonKey: { colspan: "$" },
4032
+ // HTML-C2: contribute a `colspan` attribute onto the enclosing
4033
+ // cell element (`<th>`/`<td>`).
4034
+ htmlKey: { "@el": { "@attr": { colspan: "$" } } },
4017
4035
  description: "Number of columns the cell spans.",
4018
4036
  format: TagFormat.number
4019
4037
  },
@@ -4021,6 +4039,9 @@ var CARDSETS = {
4021
4039
  key: ConfigKey.property_tableScope,
4022
4040
  jsonKey: "scope",
4023
4041
  exportJsonKey: { scope: "$" },
4042
+ // HTML-C2: contribute a `scope` attribute onto the enclosing
4043
+ // cell element (`<th>`/`<td>`).
4044
+ htmlKey: { "@el": { "@attr": { scope: "$" } } },
4024
4045
  description: "Scope attribute for header cells.",
4025
4046
  format: TagFormat.plainText
4026
4047
  },
@@ -4627,6 +4648,12 @@ var GROUPS = {
4627
4648
  format: TagFormat.coordinates,
4628
4649
  maxCount: Count.infinity
4629
4650
  },
4651
+ {
4652
+ key: ConfigKey.property_bitFingerprint,
4653
+ description: "Fingerprint(s) used by the AI extractor to identify the bit (font, style, color, pixels, etc.)",
4654
+ format: TagFormat.plainText,
4655
+ maxCount: Count.infinity
4656
+ },
4630
4657
  {
4631
4658
  key: ConfigKey.property_levelCEFRp,
4632
4659
  description: "The CEFRp level for the bit",
@@ -5831,6 +5858,16 @@ var GROUPS = {
5831
5858
  description: "External Id of the translated book",
5832
5859
  format: TagFormat.plainText
5833
5860
  },
5861
+ {
5862
+ key: ConfigKey.property_userFeedbackTranslationUrl,
5863
+ description: "URL to an external feedback form for book translation feedback",
5864
+ format: TagFormat.plainText
5865
+ },
5866
+ {
5867
+ key: ConfigKey.property_userFeedbackContentUrl,
5868
+ description: "URL to an external feedback form for book content feedback",
5869
+ format: TagFormat.plainText
5870
+ },
5834
5871
  {
5835
5872
  key: ConfigKey.property_duration,
5836
5873
  description: "The duration of the book",
@@ -10210,7 +10247,18 @@ var BITS = {
10210
10247
  since: "5.12.0",
10211
10248
  baseBitType: BitType2._standard,
10212
10249
  description: "Extractor blueprint bit, used to provide blueprint information about extractors",
10213
- textFormatDefault: TextFormat2.json
10250
+ textFormatDefault: TextFormat2.json,
10251
+ tags: [
10252
+ {
10253
+ key: ConfigKey.group_resourceBitTags,
10254
+ description: "Resource bit tags for the blueprint reference image"
10255
+ },
10256
+ {
10257
+ key: ConfigKey.group_resourceImage,
10258
+ description: "Optional uncropped reference page image, used so authoring tools can compute crops against the original page dimensions"
10259
+ }
10260
+ ],
10261
+ resourceAttachmentAllowed: false
10214
10262
  },
10215
10263
  [BitType2.extractorInformation]: {
10216
10264
  since: "3.8.0",
@@ -10933,7 +10981,9 @@ var BITS = {
10933
10981
  {
10934
10982
  key: ConfigKey.property_caption,
10935
10983
  description: "Caption for the table image, used to provide a description for the image",
10936
- format: TagFormat.bitmarkText
10984
+ format: TagFormat.bitmarkText,
10985
+ // HTML-10 / HTML-C2: render as the table's `<caption>` (see table bit).
10986
+ htmlKey: { "@el": "caption", "@children": "$" }
10937
10987
  },
10938
10988
  {
10939
10989
  key: ConfigKey.group_backgroundWallpaper,
@@ -12624,7 +12674,12 @@ var BITS = {
12624
12674
  {
12625
12675
  key: ConfigKey.property_caption,
12626
12676
  description: "Caption for the table, used to define the title of the table",
12627
- format: TagFormat.bitmarkText
12677
+ format: TagFormat.bitmarkText,
12678
+ // HTML-10 / HTML-C2: a bit-level caption renders as the table's
12679
+ // `<caption>` — placed inside the idiomatic `<table>` container as
12680
+ // its first child. Outside a table context it falls back to the
12681
+ // residual carrier.
12682
+ htmlKey: { "@el": "caption", "@children": "$" }
12628
12683
  },
12629
12684
  {
12630
12685
  key: ConfigKey.property_tableFixedHeader,
@@ -12709,7 +12764,9 @@ var BITS = {
12709
12764
  {
12710
12765
  key: ConfigKey.property_caption,
12711
12766
  description: "Caption for the table image, used to provide a description for the image",
12712
- format: TagFormat.bitmarkText
12767
+ format: TagFormat.bitmarkText,
12768
+ // HTML-10 / HTML-C2: render as the table's `<caption>` (see table bit).
12769
+ htmlKey: { "@el": "caption", "@children": "$" }
12713
12770
  },
12714
12771
  {
12715
12772
  key: ConfigKey.group_backgroundWallpaper,
@@ -13899,7 +13956,7 @@ var instance2 = new Config();
13899
13956
  // src/generated/package_info.ts
13900
13957
  var PACKAGE_INFO = {
13901
13958
  "name": "@gmb/bitmark-parser-generator",
13902
- "version": "5.27.0",
13959
+ "version": "5.29.0",
13903
13960
  "author": "Get More Brain Ltd",
13904
13961
  "license": "ISC",
13905
13962
  "description": "A bitmark parser and generator using Peggy.js"
@@ -14312,6 +14369,8 @@ var NodeType = {
14312
14369
  // bit
14313
14370
  bitType: "bitType",
14314
14371
  // bit type
14372
+ bitFingerprint: "bitFingerprint",
14373
+ bitFingerprintValue: "bitFingerprintValue",
14315
14374
  blockId: "blockId",
14316
14375
  blockIdValue: "blockIdValue",
14317
14376
  body: "body",
@@ -14789,6 +14848,10 @@ var NodeType = {
14789
14848
  relatedBookValue: "relatedBookValue",
14790
14849
  translationOfBook: "translationOfBook",
14791
14850
  translationOfBookValue: "translationOfBookValue",
14851
+ userFeedbackTranslationUrl: "userFeedbackTranslationUrl",
14852
+ userFeedbackTranslationUrlValue: "userFeedbackTranslationUrlValue",
14853
+ userFeedbackContentUrl: "userFeedbackContentUrl",
14854
+ userFeedbackContentUrlValue: "userFeedbackContentUrlValue",
14792
14855
  releaseDate: "releaseDate",
14793
14856
  releaseDateValue: "releaseDateValue",
14794
14857
  releaseKind: "releaseKind",
@@ -27936,6 +27999,12 @@ var Builder = class extends BaseBuilder {
27936
27999
  options
27937
28000
  ),
27938
28001
  sourceBB: this.normaliseSourceBB(data.sourceBB),
28002
+ bitFingerprint: this.toAstProperty(
28003
+ bitType,
28004
+ ConfigKey.property_bitFingerprint,
28005
+ data.bitFingerprint,
28006
+ options
28007
+ ),
27939
28008
  levelCEFRp: this.toAstProperty(
27940
28009
  bitType,
27941
28010
  ConfigKey.property_levelCEFRp,
@@ -27998,6 +28067,18 @@ var Builder = class extends BaseBuilder {
27998
28067
  data.translationOfBook,
27999
28068
  options
28000
28069
  ),
28070
+ userFeedbackTranslationUrl: this.toAstProperty(
28071
+ bitType,
28072
+ ConfigKey.property_userFeedbackTranslationUrl,
28073
+ data.userFeedbackTranslationUrl,
28074
+ options
28075
+ ),
28076
+ userFeedbackContentUrl: this.toAstProperty(
28077
+ bitType,
28078
+ ConfigKey.property_userFeedbackContentUrl,
28079
+ data.userFeedbackContentUrl,
28080
+ options
28081
+ ),
28001
28082
  author: this.toAstProperty(bitType, ConfigKey.property_author, data.author, options),
28002
28083
  subject: this.toAstProperty(bitType, ConfigKey.property_subject, data.subject, options),
28003
28084
  date: this.toAstProperty(bitType, ConfigKey.property_date, data.date, options),
@@ -31789,7 +31870,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
31789
31870
  this.writeNL();
31790
31871
  }
31791
31872
  const content = cell.content ?? instance3.EMPTY_STRING;
31792
- this.writeTextOrValue(content, this.textFormat, TextLocation2.body);
31873
+ const options = this.options.noBreakscaping ? { noBreakscaping: true } : void 0;
31874
+ this.writeTextOrValue(content, this.textFormat, TextLocation2.body, options);
31793
31875
  }
31794
31876
  writeTableCellProperty(name, value) {
31795
31877
  this.writeOPA();
@@ -33268,6 +33350,8 @@ var MARK_TO_TAG = {
33268
33350
  highlight: "mark",
33269
33351
  code: "code"
33270
33352
  };
33353
+ var INLINE_IMAGE_RE = /==([^=]*(?:=(?!=)[^=]*)*)==\|imageInline:([^|\s]+)((?:\|(?:@?[A-Za-z][A-Za-z0-9_-]*:[^|\s]+|#[^|\s]*))*)\|?/g;
33354
+ var MAX_IMAGE_DIMENSION = 9999;
33271
33355
  var HtmlTableGenerator = class {
33272
33356
  constructor() {
33273
33357
  __publicField(this, "indentUnit", " ");
@@ -33386,6 +33470,8 @@ var HtmlTableGenerator = class {
33386
33470
  case "image":
33387
33471
  case "imageInline":
33388
33472
  return this.imageToHtml(node);
33473
+ case "latex":
33474
+ return this.latexToHtml(node);
33389
33475
  default:
33390
33476
  return this.inlineToHtml([node]);
33391
33477
  }
@@ -33396,8 +33482,9 @@ var HtmlTableGenerator = class {
33396
33482
  inlineNodeToHtml(node) {
33397
33483
  if (node.type === "hardBreak") return "<br>";
33398
33484
  if (node.type === "image" || node.type === "imageInline") return this.imageToHtml(node);
33485
+ if (node.type === "latex") return this.latexToHtml(node);
33399
33486
  if (node.type === "text") {
33400
- return this.wrapMarks(this.escapeText(node.text ?? ""), node.marks);
33487
+ return this.wrapMarks(this.textToHtml(node.text ?? ""), node.marks);
33401
33488
  }
33402
33489
  if (node.content) return this.inlineToHtml(node.content);
33403
33490
  return this.escapeText(node.text ?? "");
@@ -33475,6 +33562,44 @@ var HtmlTableGenerator = class {
33475
33562
  }
33476
33563
  return `<img ${parts.join(" ")}>`;
33477
33564
  }
33565
+ textToHtml(text) {
33566
+ let html = "";
33567
+ let lastIndex = 0;
33568
+ for (const match of text.matchAll(INLINE_IMAGE_RE)) {
33569
+ const index = match.index ?? 0;
33570
+ html += this.escapeText(text.slice(lastIndex, index));
33571
+ html += this.inlineImageTokenToHtml(match);
33572
+ lastIndex = index + match[0].length;
33573
+ }
33574
+ html += this.escapeText(text.slice(lastIndex));
33575
+ return html;
33576
+ }
33577
+ inlineImageTokenToHtml(match) {
33578
+ const attrs = {
33579
+ alt: match[1],
33580
+ src: match[2]
33581
+ };
33582
+ const rawAttrs = match[3] ?? "";
33583
+ for (const attr of rawAttrs.split("|")) {
33584
+ if (!attr || attr.startsWith("#")) continue;
33585
+ const colon = attr.indexOf(":");
33586
+ if (colon < 1) continue;
33587
+ const key = attr.slice(0, colon).replace(/^@/, "");
33588
+ const value = attr.slice(colon + 1);
33589
+ if (key === "width" || key === "height") {
33590
+ const n = Number.parseInt(value, 10);
33591
+ if (!Number.isNaN(n) && n > 0 && n <= MAX_IMAGE_DIMENSION) attrs[key] = n;
33592
+ } else if (key === "class" || key === "title") {
33593
+ attrs[key] = value;
33594
+ }
33595
+ }
33596
+ return this.imageToHtml({ type: "imageInline", attrs });
33597
+ }
33598
+ // --- formulas -------------------------------------------------------------
33599
+ latexToHtml(node) {
33600
+ const formula = node.attrs?.formula ?? "";
33601
+ return `<math alttext="${this.escapeAttr(formula)}"></math>`;
33602
+ }
33478
33603
  // --- escaping -------------------------------------------------------------
33479
33604
  escapeText(text) {
33480
33605
  return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -33786,6 +33911,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
33786
33911
  this.addProperty(this.bitJson, k, values, { array: true });
33787
33912
  }
33788
33913
  }
33914
+ return false;
33789
33915
  }
33790
33916
  // bitmarkAst -> bits -> bitsValue -> cardNode -> cardBits -> cardBitsValue
33791
33917
  enter_cardBitsValue(node, route) {
@@ -42820,7 +42946,7 @@ var IMPLIED_CLOSE = {
42820
42946
  p: /* @__PURE__ */ new Set(["p"]),
42821
42947
  option: /* @__PURE__ */ new Set(["option"])
42822
42948
  };
42823
- var TAG_RE = /<(\/)?([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:"[^"]*"|'[^']*'|[^<>"'])*)?)(\/)?>/g;
42949
+ var TAG_RE = /<(\/)?([a-zA-Z][a-zA-Z0-9:-]*)((?:\s+(?:"[^"]*"|'[^']*'|[^<>"'])*)?)(\/)?>/g;
42824
42950
  var ATTR_RE = /([a-zA-Z_:][a-zA-Z0-9:._-]*)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s"'>]+))?/g;
42825
42951
  function parseAttrs(raw) {
42826
42952
  const attrs = {};
@@ -43151,6 +43277,9 @@ var HtmlTableParser = class {
43151
43277
  if (name === "img") {
43152
43278
  return [this.imageNode(el, true)];
43153
43279
  }
43280
+ if (this.isMathTag(name)) {
43281
+ return [this.latexNode(el)];
43282
+ }
43154
43283
  const markType = MARK_TAGS[name];
43155
43284
  if (markType) {
43156
43285
  return this.inlineNodes(el.children, [...marks, { type: markType }]);
@@ -43267,6 +43396,43 @@ var HtmlTableParser = class {
43267
43396
  if (el.attrs.class) attrs.class = el.attrs.class;
43268
43397
  return { type: inline ? "imageInline" : "image", attrs };
43269
43398
  }
43399
+ // --- formulas -------------------------------------------------------------
43400
+ isMathTag(name) {
43401
+ return this.localName(name) === "math";
43402
+ }
43403
+ latexNode(el) {
43404
+ return {
43405
+ type: "latex",
43406
+ attrs: {
43407
+ formula: this.latexFromMath(el)
43408
+ }
43409
+ };
43410
+ }
43411
+ latexFromMath(el) {
43412
+ const alt = el.attrs.alttext ?? el.attrs.alt ?? el.attrs.title;
43413
+ if (alt != null) return decodeEntities(alt);
43414
+ const annotation = this.findLatexAnnotation(el);
43415
+ if (annotation) return this.textContent(annotation).trim();
43416
+ return this.textContent(el).trim();
43417
+ }
43418
+ findLatexAnnotation(el) {
43419
+ for (const child of el.children) {
43420
+ if (!isElement(child)) continue;
43421
+ const lowerEncoding = (child.attrs.encoding ?? "").toLowerCase();
43422
+ if (this.localName(child.name) === "annotation" && (/\btex\b/.test(lowerEncoding) || /\blatex\b/.test(lowerEncoding))) {
43423
+ return child;
43424
+ }
43425
+ const nested = this.findLatexAnnotation(child);
43426
+ if (nested) return nested;
43427
+ }
43428
+ return void 0;
43429
+ }
43430
+ textContent(el) {
43431
+ return el.children.map((child) => isElement(child) ? this.textContent(child) : decodeEntities(child.value)).join("").replace(/\s+/g, " ");
43432
+ }
43433
+ localName(name) {
43434
+ return name.includes(":") ? name.slice(name.indexOf(":") + 1) : name;
43435
+ }
43270
43436
  // --- whitespace -----------------------------------------------------------
43271
43437
  /** Trim leading/trailing whitespace from inline content (edges only). */
43272
43438
  trimInline(nodes) {
@@ -43921,7 +44087,10 @@ var BitmarkParserGenerator = class {
43921
44087
  outputFile: opts.outputFile,
43922
44088
  fileOptions: opts.fileOptions,
43923
44089
  jsonOptions: opts.jsonOptions,
43924
- bitmarkOptions: opts.bitmarkOptions
44090
+ bitmarkOptions: {
44091
+ ...opts.bitmarkOptions,
44092
+ ...opts.noBreakscaping ? { noBreakscaping: true } : {}
44093
+ }
43925
44094
  });
43926
44095
  }
43927
44096
  const outputFormat = opts.outputFormat ?? "html";