@gmb/bitmark-parser-generator 5.27.0 → 5.28.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.
package/dist/index.d.cts CHANGED
@@ -850,6 +850,8 @@ declare const ConfigKey: {
850
850
  readonly property_externalLinkText: "@externalLinkText";
851
851
  readonly property_feedbackEngine: "@feedbackEngine";
852
852
  readonly property_feedbackType: "@feedbackType";
853
+ readonly property_userFeedbackTranslationUrl: "@userFeedbackTranslationUrl";
854
+ readonly property_userFeedbackContentUrl: "@userFeedbackContentUrl";
853
855
  readonly property_flashcardSet: "@flashcardSet";
854
856
  readonly property_focusX: "@focusX";
855
857
  readonly property_focusY: "@focusY";
@@ -1760,6 +1762,8 @@ interface BitJson {
1760
1762
  publisherName: string;
1761
1763
  publications: string | string[];
1762
1764
  relatedBook: string | string[];
1765
+ userFeedbackTranslationUrl: string;
1766
+ userFeedbackContentUrl: string;
1763
1767
  author: string | string[];
1764
1768
  subject: string | string[];
1765
1769
  date: string;
@@ -2381,6 +2385,8 @@ interface Bit {
2381
2385
  publications?: Property;
2382
2386
  relatedBook?: Property;
2383
2387
  translationOfBook?: Property;
2388
+ userFeedbackTranslationUrl?: Property;
2389
+ userFeedbackContentUrl?: Property;
2384
2390
  author?: Property;
2385
2391
  subject?: Property;
2386
2392
  date?: Property;
@@ -3186,6 +3192,10 @@ declare const NodeType: {
3186
3192
  readonly relatedBookValue: "relatedBookValue";
3187
3193
  readonly translationOfBook: "translationOfBook";
3188
3194
  readonly translationOfBookValue: "translationOfBookValue";
3195
+ readonly userFeedbackTranslationUrl: "userFeedbackTranslationUrl";
3196
+ readonly userFeedbackTranslationUrlValue: "userFeedbackTranslationUrlValue";
3197
+ readonly userFeedbackContentUrl: "userFeedbackContentUrl";
3198
+ readonly userFeedbackContentUrlValue: "userFeedbackContentUrlValue";
3189
3199
  readonly releaseDate: "releaseDate";
3190
3200
  readonly releaseDateValue: "releaseDateValue";
3191
3201
  readonly releaseKind: "releaseKind";
@@ -4353,6 +4363,8 @@ declare class Builder extends BaseBuilder {
4353
4363
  publications?: string | string[];
4354
4364
  relatedBook?: string | string[];
4355
4365
  translationOfBook?: string;
4366
+ userFeedbackTranslationUrl?: string;
4367
+ userFeedbackContentUrl?: string;
4356
4368
  author?: string | string[];
4357
4369
  subject?: string | string[];
4358
4370
  date?: string;
@@ -5595,6 +5607,10 @@ interface BitmarkOptions {
5595
5607
  * Generate debug information in the output.
5596
5608
  */
5597
5609
  debugGenerationInline?: boolean;
5610
+ /**
5611
+ * Generate table cell content without breakscaping text.
5612
+ */
5613
+ noBreakscaping?: boolean;
5598
5614
  }
5599
5615
  /**
5600
5616
  * Bitmark generator options
@@ -6124,7 +6140,7 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
6124
6140
  protected enter_caption(node: NodeInfo, route: NodeInfo[]): boolean;
6125
6141
  protected enter_width(node: NodeInfo, route: NodeInfo[]): boolean;
6126
6142
  protected enter_height(node: NodeInfo, route: NodeInfo[]): boolean;
6127
- protected enter_extraProperties(node: NodeInfo, _route: NodeInfo[]): void;
6143
+ protected enter_extraProperties(node: NodeInfo, _route: NodeInfo[]): boolean;
6128
6144
  protected enter_cardBitsValue(node: NodeInfo, route: NodeInfo[]): void;
6129
6145
  protected exit_cardBitsValue(_node: NodeInfo, _route: NodeInfo[]): void;
6130
6146
  protected enter_body(node: NodeInfo, route: NodeInfo[]): boolean;
@@ -6489,6 +6505,12 @@ declare class HtmlTableParser {
6489
6505
  private listItemNode;
6490
6506
  private taskItemNode;
6491
6507
  private imageNode;
6508
+ private isMathTag;
6509
+ private latexNode;
6510
+ private latexFromMath;
6511
+ private findLatexAnnotation;
6512
+ private textContent;
6513
+ private localName;
6492
6514
  /** Trim leading/trailing whitespace from inline content (edges only). */
6493
6515
  private trimInline;
6494
6516
  }
@@ -6754,6 +6776,11 @@ interface ConvertHtmlTableOptions {
6754
6776
  * Keep unmappable HTML tags as literal text instead of unwrapping them (HTML -> bits only).
6755
6777
  */
6756
6778
  keepUnknownTags?: boolean;
6779
+ /**
6780
+ * Disable breakscaping when generating bitmark table cell content from HTML.
6781
+ * Useful when cells already contain raw bitmark that should pass through untouched.
6782
+ */
6783
+ noBreakscaping?: boolean;
6757
6784
  /**
6758
6785
  * Specify a file to write the output to
6759
6786
  */
@@ -7342,6 +7369,9 @@ declare class HtmlTableGenerator {
7342
7369
  private listTag;
7343
7370
  private listItemToHtml;
7344
7371
  private imageToHtml;
7372
+ private textToHtml;
7373
+ private inlineImageTokenToHtml;
7374
+ private latexToHtml;
7345
7375
  private escapeText;
7346
7376
  private escapeAttr;
7347
7377
  }
package/dist/index.d.ts CHANGED
@@ -850,6 +850,8 @@ declare const ConfigKey: {
850
850
  readonly property_externalLinkText: "@externalLinkText";
851
851
  readonly property_feedbackEngine: "@feedbackEngine";
852
852
  readonly property_feedbackType: "@feedbackType";
853
+ readonly property_userFeedbackTranslationUrl: "@userFeedbackTranslationUrl";
854
+ readonly property_userFeedbackContentUrl: "@userFeedbackContentUrl";
853
855
  readonly property_flashcardSet: "@flashcardSet";
854
856
  readonly property_focusX: "@focusX";
855
857
  readonly property_focusY: "@focusY";
@@ -1760,6 +1762,8 @@ interface BitJson {
1760
1762
  publisherName: string;
1761
1763
  publications: string | string[];
1762
1764
  relatedBook: string | string[];
1765
+ userFeedbackTranslationUrl: string;
1766
+ userFeedbackContentUrl: string;
1763
1767
  author: string | string[];
1764
1768
  subject: string | string[];
1765
1769
  date: string;
@@ -2381,6 +2385,8 @@ interface Bit {
2381
2385
  publications?: Property;
2382
2386
  relatedBook?: Property;
2383
2387
  translationOfBook?: Property;
2388
+ userFeedbackTranslationUrl?: Property;
2389
+ userFeedbackContentUrl?: Property;
2384
2390
  author?: Property;
2385
2391
  subject?: Property;
2386
2392
  date?: Property;
@@ -3186,6 +3192,10 @@ declare const NodeType: {
3186
3192
  readonly relatedBookValue: "relatedBookValue";
3187
3193
  readonly translationOfBook: "translationOfBook";
3188
3194
  readonly translationOfBookValue: "translationOfBookValue";
3195
+ readonly userFeedbackTranslationUrl: "userFeedbackTranslationUrl";
3196
+ readonly userFeedbackTranslationUrlValue: "userFeedbackTranslationUrlValue";
3197
+ readonly userFeedbackContentUrl: "userFeedbackContentUrl";
3198
+ readonly userFeedbackContentUrlValue: "userFeedbackContentUrlValue";
3189
3199
  readonly releaseDate: "releaseDate";
3190
3200
  readonly releaseDateValue: "releaseDateValue";
3191
3201
  readonly releaseKind: "releaseKind";
@@ -4353,6 +4363,8 @@ declare class Builder extends BaseBuilder {
4353
4363
  publications?: string | string[];
4354
4364
  relatedBook?: string | string[];
4355
4365
  translationOfBook?: string;
4366
+ userFeedbackTranslationUrl?: string;
4367
+ userFeedbackContentUrl?: string;
4356
4368
  author?: string | string[];
4357
4369
  subject?: string | string[];
4358
4370
  date?: string;
@@ -5595,6 +5607,10 @@ interface BitmarkOptions {
5595
5607
  * Generate debug information in the output.
5596
5608
  */
5597
5609
  debugGenerationInline?: boolean;
5610
+ /**
5611
+ * Generate table cell content without breakscaping text.
5612
+ */
5613
+ noBreakscaping?: boolean;
5598
5614
  }
5599
5615
  /**
5600
5616
  * Bitmark generator options
@@ -6124,7 +6140,7 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
6124
6140
  protected enter_caption(node: NodeInfo, route: NodeInfo[]): boolean;
6125
6141
  protected enter_width(node: NodeInfo, route: NodeInfo[]): boolean;
6126
6142
  protected enter_height(node: NodeInfo, route: NodeInfo[]): boolean;
6127
- protected enter_extraProperties(node: NodeInfo, _route: NodeInfo[]): void;
6143
+ protected enter_extraProperties(node: NodeInfo, _route: NodeInfo[]): boolean;
6128
6144
  protected enter_cardBitsValue(node: NodeInfo, route: NodeInfo[]): void;
6129
6145
  protected exit_cardBitsValue(_node: NodeInfo, _route: NodeInfo[]): void;
6130
6146
  protected enter_body(node: NodeInfo, route: NodeInfo[]): boolean;
@@ -6489,6 +6505,12 @@ declare class HtmlTableParser {
6489
6505
  private listItemNode;
6490
6506
  private taskItemNode;
6491
6507
  private imageNode;
6508
+ private isMathTag;
6509
+ private latexNode;
6510
+ private latexFromMath;
6511
+ private findLatexAnnotation;
6512
+ private textContent;
6513
+ private localName;
6492
6514
  /** Trim leading/trailing whitespace from inline content (edges only). */
6493
6515
  private trimInline;
6494
6516
  }
@@ -6754,6 +6776,11 @@ interface ConvertHtmlTableOptions {
6754
6776
  * Keep unmappable HTML tags as literal text instead of unwrapping them (HTML -> bits only).
6755
6777
  */
6756
6778
  keepUnknownTags?: boolean;
6779
+ /**
6780
+ * Disable breakscaping when generating bitmark table cell content from HTML.
6781
+ * Useful when cells already contain raw bitmark that should pass through untouched.
6782
+ */
6783
+ noBreakscaping?: boolean;
6757
6784
  /**
6758
6785
  * Specify a file to write the output to
6759
6786
  */
@@ -7342,6 +7369,9 @@ declare class HtmlTableGenerator {
7342
7369
  private listTag;
7343
7370
  private listItemToHtml;
7344
7371
  private imageToHtml;
7372
+ private textToHtml;
7373
+ private inlineImageTokenToHtml;
7374
+ private latexToHtml;
7345
7375
  private escapeText;
7346
7376
  private escapeAttr;
7347
7377
  }
package/dist/index.js CHANGED
@@ -1365,6 +1365,8 @@ var propertyKeys = {
1365
1365
  property_externalLinkText: "@externalLinkText",
1366
1366
  property_feedbackEngine: "@feedbackEngine",
1367
1367
  property_feedbackType: "@feedbackType",
1368
+ property_userFeedbackTranslationUrl: "@userFeedbackTranslationUrl",
1369
+ property_userFeedbackContentUrl: "@userFeedbackContentUrl",
1368
1370
  property_flashcardSet: "@flashcardSet",
1369
1371
  property_focusX: "@focusX",
1370
1372
  property_focusY: "@focusY",
@@ -3829,16 +3831,25 @@ var CARDSETS = {
3829
3831
  },
3830
3832
  {
3831
3833
  key: ConfigKey.property_tableRowSpan,
3834
+ // HTML-C2: contribute a `rowspan` attribute onto the enclosing
3835
+ // cell element (`<th>`/`<td>`).
3836
+ htmlKey: { "@el": { "@attr": { rowspan: "$" } } },
3832
3837
  description: "Number of rows the cell spans.",
3833
3838
  format: TagFormat.number
3834
3839
  },
3835
3840
  {
3836
3841
  key: ConfigKey.property_tableColSpan,
3842
+ // HTML-C2: contribute a `colspan` attribute onto the enclosing
3843
+ // cell element (`<th>`/`<td>`).
3844
+ htmlKey: { "@el": { "@attr": { colspan: "$" } } },
3837
3845
  description: "Number of columns the cell spans.",
3838
3846
  format: TagFormat.number
3839
3847
  },
3840
3848
  {
3841
3849
  key: ConfigKey.property_tableScope,
3850
+ // HTML-C2: contribute a `scope` attribute onto the enclosing
3851
+ // cell element (`<th>`/`<td>`).
3852
+ htmlKey: { "@el": { "@attr": { scope: "$" } } },
3842
3853
  description: "Scope attribute for header cells.",
3843
3854
  format: TagFormat.plainText
3844
3855
  },
@@ -3956,6 +3967,9 @@ var CARDSETS = {
3956
3967
  key: ConfigKey.property_tableRowSpan,
3957
3968
  jsonKey: "rowspan",
3958
3969
  exportJsonKey: { rowspan: "$" },
3970
+ // HTML-C2: contribute a `rowspan` attribute onto the enclosing
3971
+ // cell element (`<th>`/`<td>`).
3972
+ htmlKey: { "@el": { "@attr": { rowspan: "$" } } },
3959
3973
  description: "Number of rows the cell spans.",
3960
3974
  format: TagFormat.number
3961
3975
  },
@@ -3963,6 +3977,9 @@ var CARDSETS = {
3963
3977
  key: ConfigKey.property_tableColSpan,
3964
3978
  jsonKey: "colspan",
3965
3979
  exportJsonKey: { colspan: "$" },
3980
+ // HTML-C2: contribute a `colspan` attribute onto the enclosing
3981
+ // cell element (`<th>`/`<td>`).
3982
+ htmlKey: { "@el": { "@attr": { colspan: "$" } } },
3966
3983
  description: "Number of columns the cell spans.",
3967
3984
  format: TagFormat.number
3968
3985
  },
@@ -3970,6 +3987,9 @@ var CARDSETS = {
3970
3987
  key: ConfigKey.property_tableScope,
3971
3988
  jsonKey: "scope",
3972
3989
  exportJsonKey: { scope: "$" },
3990
+ // HTML-C2: contribute a `scope` attribute onto the enclosing
3991
+ // cell element (`<th>`/`<td>`).
3992
+ htmlKey: { "@el": { "@attr": { scope: "$" } } },
3973
3993
  description: "Scope attribute for header cells.",
3974
3994
  format: TagFormat.plainText
3975
3995
  },
@@ -5780,6 +5800,16 @@ var GROUPS = {
5780
5800
  description: "External Id of the translated book",
5781
5801
  format: TagFormat.plainText
5782
5802
  },
5803
+ {
5804
+ key: ConfigKey.property_userFeedbackTranslationUrl,
5805
+ description: "URL to an external feedback form for book translation feedback",
5806
+ format: TagFormat.plainText
5807
+ },
5808
+ {
5809
+ key: ConfigKey.property_userFeedbackContentUrl,
5810
+ description: "URL to an external feedback form for book content feedback",
5811
+ format: TagFormat.plainText
5812
+ },
5783
5813
  {
5784
5814
  key: ConfigKey.property_duration,
5785
5815
  description: "The duration of the book",
@@ -10882,7 +10912,9 @@ var BITS = {
10882
10912
  {
10883
10913
  key: ConfigKey.property_caption,
10884
10914
  description: "Caption for the table image, used to provide a description for the image",
10885
- format: TagFormat.bitmarkText
10915
+ format: TagFormat.bitmarkText,
10916
+ // HTML-10 / HTML-C2: render as the table's `<caption>` (see table bit).
10917
+ htmlKey: { "@el": "caption", "@children": "$" }
10886
10918
  },
10887
10919
  {
10888
10920
  key: ConfigKey.group_backgroundWallpaper,
@@ -12573,7 +12605,12 @@ var BITS = {
12573
12605
  {
12574
12606
  key: ConfigKey.property_caption,
12575
12607
  description: "Caption for the table, used to define the title of the table",
12576
- format: TagFormat.bitmarkText
12608
+ format: TagFormat.bitmarkText,
12609
+ // HTML-10 / HTML-C2: a bit-level caption renders as the table's
12610
+ // `<caption>` — placed inside the idiomatic `<table>` container as
12611
+ // its first child. Outside a table context it falls back to the
12612
+ // residual carrier.
12613
+ htmlKey: { "@el": "caption", "@children": "$" }
12577
12614
  },
12578
12615
  {
12579
12616
  key: ConfigKey.property_tableFixedHeader,
@@ -12658,7 +12695,9 @@ var BITS = {
12658
12695
  {
12659
12696
  key: ConfigKey.property_caption,
12660
12697
  description: "Caption for the table image, used to provide a description for the image",
12661
- format: TagFormat.bitmarkText
12698
+ format: TagFormat.bitmarkText,
12699
+ // HTML-10 / HTML-C2: render as the table's `<caption>` (see table bit).
12700
+ htmlKey: { "@el": "caption", "@children": "$" }
12662
12701
  },
12663
12702
  {
12664
12703
  key: ConfigKey.group_backgroundWallpaper,
@@ -13848,7 +13887,7 @@ var instance2 = new Config();
13848
13887
  // src/generated/package_info.ts
13849
13888
  var PACKAGE_INFO = {
13850
13889
  "name": "@gmb/bitmark-parser-generator",
13851
- "version": "5.27.0",
13890
+ "version": "5.28.0",
13852
13891
  "author": "Get More Brain Ltd",
13853
13892
  "license": "ISC",
13854
13893
  "description": "A bitmark parser and generator using Peggy.js"
@@ -14738,6 +14777,10 @@ var NodeType = {
14738
14777
  relatedBookValue: "relatedBookValue",
14739
14778
  translationOfBook: "translationOfBook",
14740
14779
  translationOfBookValue: "translationOfBookValue",
14780
+ userFeedbackTranslationUrl: "userFeedbackTranslationUrl",
14781
+ userFeedbackTranslationUrlValue: "userFeedbackTranslationUrlValue",
14782
+ userFeedbackContentUrl: "userFeedbackContentUrl",
14783
+ userFeedbackContentUrlValue: "userFeedbackContentUrlValue",
14741
14784
  releaseDate: "releaseDate",
14742
14785
  releaseDateValue: "releaseDateValue",
14743
14786
  releaseKind: "releaseKind",
@@ -27947,6 +27990,18 @@ var Builder = class extends BaseBuilder {
27947
27990
  data.translationOfBook,
27948
27991
  options
27949
27992
  ),
27993
+ userFeedbackTranslationUrl: this.toAstProperty(
27994
+ bitType,
27995
+ ConfigKey.property_userFeedbackTranslationUrl,
27996
+ data.userFeedbackTranslationUrl,
27997
+ options
27998
+ ),
27999
+ userFeedbackContentUrl: this.toAstProperty(
28000
+ bitType,
28001
+ ConfigKey.property_userFeedbackContentUrl,
28002
+ data.userFeedbackContentUrl,
28003
+ options
28004
+ ),
27950
28005
  author: this.toAstProperty(bitType, ConfigKey.property_author, data.author, options),
27951
28006
  subject: this.toAstProperty(bitType, ConfigKey.property_subject, data.subject, options),
27952
28007
  date: this.toAstProperty(bitType, ConfigKey.property_date, data.date, options),
@@ -31738,7 +31793,8 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
31738
31793
  this.writeNL();
31739
31794
  }
31740
31795
  const content = cell.content ?? instance3.EMPTY_STRING;
31741
- this.writeTextOrValue(content, this.textFormat, TextLocation.body);
31796
+ const options = this.options.noBreakscaping ? { noBreakscaping: true } : void 0;
31797
+ this.writeTextOrValue(content, this.textFormat, TextLocation.body, options);
31742
31798
  }
31743
31799
  writeTableCellProperty(name, value) {
31744
31800
  this.writeOPA();
@@ -33217,6 +33273,8 @@ var MARK_TO_TAG = {
33217
33273
  highlight: "mark",
33218
33274
  code: "code"
33219
33275
  };
33276
+ var INLINE_IMAGE_RE = /==([^=]*(?:=(?!=)[^=]*)*)==\|imageInline:([^|\s]+)((?:\|(?:@?[A-Za-z][A-Za-z0-9_-]*:[^|\s]+|#[^|\s]*))*)\|?/g;
33277
+ var MAX_IMAGE_DIMENSION = 9999;
33220
33278
  var HtmlTableGenerator = class {
33221
33279
  constructor() {
33222
33280
  __publicField(this, "indentUnit", " ");
@@ -33335,6 +33393,8 @@ var HtmlTableGenerator = class {
33335
33393
  case "image":
33336
33394
  case "imageInline":
33337
33395
  return this.imageToHtml(node);
33396
+ case "latex":
33397
+ return this.latexToHtml(node);
33338
33398
  default:
33339
33399
  return this.inlineToHtml([node]);
33340
33400
  }
@@ -33345,8 +33405,9 @@ var HtmlTableGenerator = class {
33345
33405
  inlineNodeToHtml(node) {
33346
33406
  if (node.type === "hardBreak") return "<br>";
33347
33407
  if (node.type === "image" || node.type === "imageInline") return this.imageToHtml(node);
33408
+ if (node.type === "latex") return this.latexToHtml(node);
33348
33409
  if (node.type === "text") {
33349
- return this.wrapMarks(this.escapeText(node.text ?? ""), node.marks);
33410
+ return this.wrapMarks(this.textToHtml(node.text ?? ""), node.marks);
33350
33411
  }
33351
33412
  if (node.content) return this.inlineToHtml(node.content);
33352
33413
  return this.escapeText(node.text ?? "");
@@ -33424,6 +33485,44 @@ var HtmlTableGenerator = class {
33424
33485
  }
33425
33486
  return `<img ${parts.join(" ")}>`;
33426
33487
  }
33488
+ textToHtml(text) {
33489
+ let html = "";
33490
+ let lastIndex = 0;
33491
+ for (const match of text.matchAll(INLINE_IMAGE_RE)) {
33492
+ const index = match.index ?? 0;
33493
+ html += this.escapeText(text.slice(lastIndex, index));
33494
+ html += this.inlineImageTokenToHtml(match);
33495
+ lastIndex = index + match[0].length;
33496
+ }
33497
+ html += this.escapeText(text.slice(lastIndex));
33498
+ return html;
33499
+ }
33500
+ inlineImageTokenToHtml(match) {
33501
+ const attrs = {
33502
+ alt: match[1],
33503
+ src: match[2]
33504
+ };
33505
+ const rawAttrs = match[3] ?? "";
33506
+ for (const attr of rawAttrs.split("|")) {
33507
+ if (!attr || attr.startsWith("#")) continue;
33508
+ const colon = attr.indexOf(":");
33509
+ if (colon < 1) continue;
33510
+ const key = attr.slice(0, colon).replace(/^@/, "");
33511
+ const value = attr.slice(colon + 1);
33512
+ if (key === "width" || key === "height") {
33513
+ const n = Number.parseInt(value, 10);
33514
+ if (!Number.isNaN(n) && n > 0 && n <= MAX_IMAGE_DIMENSION) attrs[key] = n;
33515
+ } else if (key === "class" || key === "title") {
33516
+ attrs[key] = value;
33517
+ }
33518
+ }
33519
+ return this.imageToHtml({ type: "imageInline", attrs });
33520
+ }
33521
+ // --- formulas -------------------------------------------------------------
33522
+ latexToHtml(node) {
33523
+ const formula = node.attrs?.formula ?? "";
33524
+ return `<math alttext="${this.escapeAttr(formula)}"></math>`;
33525
+ }
33427
33526
  // --- escaping -------------------------------------------------------------
33428
33527
  escapeText(text) {
33429
33528
  return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -33735,6 +33834,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
33735
33834
  this.addProperty(this.bitJson, k, values, { array: true });
33736
33835
  }
33737
33836
  }
33837
+ return false;
33738
33838
  }
33739
33839
  // bitmarkAst -> bits -> bitsValue -> cardNode -> cardBits -> cardBitsValue
33740
33840
  enter_cardBitsValue(node, route) {
@@ -42805,7 +42905,7 @@ var IMPLIED_CLOSE = {
42805
42905
  p: /* @__PURE__ */ new Set(["p"]),
42806
42906
  option: /* @__PURE__ */ new Set(["option"])
42807
42907
  };
42808
- var TAG_RE = /<(\/)?([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:"[^"]*"|'[^']*'|[^<>"'])*)?)(\/)?>/g;
42908
+ var TAG_RE = /<(\/)?([a-zA-Z][a-zA-Z0-9:-]*)((?:\s+(?:"[^"]*"|'[^']*'|[^<>"'])*)?)(\/)?>/g;
42809
42909
  var ATTR_RE = /([a-zA-Z_:][a-zA-Z0-9:._-]*)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s"'>]+))?/g;
42810
42910
  function parseAttrs(raw) {
42811
42911
  const attrs = {};
@@ -43136,6 +43236,9 @@ var HtmlTableParser = class {
43136
43236
  if (name === "img") {
43137
43237
  return [this.imageNode(el, true)];
43138
43238
  }
43239
+ if (this.isMathTag(name)) {
43240
+ return [this.latexNode(el)];
43241
+ }
43139
43242
  const markType = MARK_TAGS[name];
43140
43243
  if (markType) {
43141
43244
  return this.inlineNodes(el.children, [...marks, { type: markType }]);
@@ -43252,6 +43355,43 @@ var HtmlTableParser = class {
43252
43355
  if (el.attrs.class) attrs.class = el.attrs.class;
43253
43356
  return { type: inline ? "imageInline" : "image", attrs };
43254
43357
  }
43358
+ // --- formulas -------------------------------------------------------------
43359
+ isMathTag(name) {
43360
+ return this.localName(name) === "math";
43361
+ }
43362
+ latexNode(el) {
43363
+ return {
43364
+ type: "latex",
43365
+ attrs: {
43366
+ formula: this.latexFromMath(el)
43367
+ }
43368
+ };
43369
+ }
43370
+ latexFromMath(el) {
43371
+ const alt = el.attrs.alttext ?? el.attrs.alt ?? el.attrs.title;
43372
+ if (alt != null) return decodeEntities(alt);
43373
+ const annotation = this.findLatexAnnotation(el);
43374
+ if (annotation) return this.textContent(annotation).trim();
43375
+ return this.textContent(el).trim();
43376
+ }
43377
+ findLatexAnnotation(el) {
43378
+ for (const child of el.children) {
43379
+ if (!isElement(child)) continue;
43380
+ const lowerEncoding = (child.attrs.encoding ?? "").toLowerCase();
43381
+ if (this.localName(child.name) === "annotation" && (/\btex\b/.test(lowerEncoding) || /\blatex\b/.test(lowerEncoding))) {
43382
+ return child;
43383
+ }
43384
+ const nested = this.findLatexAnnotation(child);
43385
+ if (nested) return nested;
43386
+ }
43387
+ return void 0;
43388
+ }
43389
+ textContent(el) {
43390
+ return el.children.map((child) => isElement(child) ? this.textContent(child) : decodeEntities(child.value)).join("").replace(/\s+/g, " ");
43391
+ }
43392
+ localName(name) {
43393
+ return name.includes(":") ? name.slice(name.indexOf(":") + 1) : name;
43394
+ }
43255
43395
  // --- whitespace -----------------------------------------------------------
43256
43396
  /** Trim leading/trailing whitespace from inline content (edges only). */
43257
43397
  trimInline(nodes) {
@@ -45202,7 +45342,10 @@ var BitmarkParserGenerator = class {
45202
45342
  outputFile: opts.outputFile,
45203
45343
  fileOptions: opts.fileOptions,
45204
45344
  jsonOptions: opts.jsonOptions,
45205
- bitmarkOptions: opts.bitmarkOptions
45345
+ bitmarkOptions: {
45346
+ ...opts.bitmarkOptions,
45347
+ ...opts.noBreakscaping ? { noBreakscaping: true } : {}
45348
+ }
45206
45349
  });
45207
45350
  }
45208
45351
  const outputFormat = opts.outputFormat ?? "html";