@gmb/bitmark-parser-generator 5.26.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.ts CHANGED
@@ -536,6 +536,14 @@ declare const BitType: {
536
536
  readonly smartStandardRemarkNonNormativeCollapsible: "smart-standard-remark-non-normative-collapsible";
537
537
  readonly smartStandardRemarkNormative: "smart-standard-remark-normative";
538
538
  readonly smartStandardRemarkNormativeCollapsible: "smart-standard-remark-normative-collapsible";
539
+ readonly smartStandardRemarkTableExtendedImageNonNormative: "smart-standard-remark-table-extended-image-non-normative";
540
+ readonly smartStandardRemarkTableExtendedImageNonNormativeCollapsible: "smart-standard-remark-table-extended-image-non-normative-collapsible";
541
+ readonly smartStandardRemarkTableExtendedImageNormative: "smart-standard-remark-table-extended-image-normative";
542
+ readonly smartStandardRemarkTableExtendedImageNormativeCollapsible: "smart-standard-remark-table-extended-image-normative-collapsible";
543
+ readonly smartStandardRemarkTableExtendedNonNormative: "smart-standard-remark-table-extended-non-normative";
544
+ readonly smartStandardRemarkTableExtendedNonNormativeCollapsible: "smart-standard-remark-table-extended-non-normative-collapsible";
545
+ readonly smartStandardRemarkTableExtendedNormative: "smart-standard-remark-table-extended-normative";
546
+ readonly smartStandardRemarkTableExtendedNormativeCollapsible: "smart-standard-remark-table-extended-normative-collapsible";
539
547
  readonly smartStandardRemarkTableImageNonNormative: "smart-standard-remark-table-image-non-normative";
540
548
  readonly smartStandardRemarkTableImageNonNormativeCollapsible: "smart-standard-remark-table-image-non-normative-collapsible";
541
549
  readonly smartStandardRemarkTableImageNormative: "smart-standard-remark-table-image-normative";
@@ -544,6 +552,14 @@ declare const BitType: {
544
552
  readonly smartStandardRemarkTableNonNormativeCollapsible: "smart-standard-remark-table-non-normative-collapsible";
545
553
  readonly smartStandardRemarkTableNormative: "smart-standard-remark-table-normative";
546
554
  readonly smartStandardRemarkTableNormativeCollapsible: "smart-standard-remark-table-normative-collapsible";
555
+ readonly smartStandardTableExtendedImageNonNormative: "smart-standard-table-extended-image-non-normative";
556
+ readonly smartStandardTableExtendedImageNonNormativeCollapsible: "smart-standard-table-extended-image-non-normative-collapsible";
557
+ readonly smartStandardTableExtendedImageNormative: "smart-standard-table-extended-image-normative";
558
+ readonly smartStandardTableExtendedImageNormativeCollapsible: "smart-standard-table-extended-image-normative-collapsible";
559
+ readonly smartStandardTableExtendedNonNormative: "smart-standard-table-extended-non-normative";
560
+ readonly smartStandardTableExtendedNonNormativeCollapsible: "smart-standard-table-extended-non-normative-collapsible";
561
+ readonly smartStandardTableExtendedNormative: "smart-standard-table-extended-normative";
562
+ readonly smartStandardTableExtendedNormativeCollapsible: "smart-standard-table-extended-normative-collapsible";
547
563
  readonly smartStandardTableImageNonNormative: "smart-standard-table-image-non-normative";
548
564
  readonly smartStandardTableImageNonNormativeCollapsible: "smart-standard-table-image-non-normative-collapsible";
549
565
  readonly smartStandardTableImageNormative: "smart-standard-table-image-normative";
@@ -566,10 +582,18 @@ declare const BitType: {
566
582
  readonly standardNoteNormative: "standard-note-normative";
567
583
  readonly standardRemarkNonNormative: "standard-remark-non-normative";
568
584
  readonly standardRemarkNormative: "standard-remark-normative";
585
+ readonly standardRemarkTableExtendedImageNonNormative: "standard-remark-table-extended-image-non-normative";
586
+ readonly standardRemarkTableExtendedImageNormative: "standard-remark-table-extended-image-normative";
587
+ readonly standardRemarkTableExtendedNonNormative: "standard-remark-table-extended-non-normative";
588
+ readonly standardRemarkTableExtendedNormative: "standard-remark-table-extended-normative";
569
589
  readonly standardRemarkTableImageNonNormative: "standard-remark-table-image-non-normative";
570
590
  readonly standardRemarkTableImageNormative: "standard-remark-table-image-normative";
571
591
  readonly standardRemarkTableNonNormative: "standard-remark-table-non-normative";
572
592
  readonly standardRemarkTableNormative: "standard-remark-table-normative";
593
+ readonly standardTableExtendedImageNonNormative: "standard-table-extended-image-non-normative";
594
+ readonly standardTableExtendedImageNormative: "standard-table-extended-image-normative";
595
+ readonly standardTableExtendedNonNormative: "standard-table-extended-non-normative";
596
+ readonly standardTableExtendedNormative: "standard-table-extended-normative";
573
597
  readonly standardTableImageNonNormative: "standard-table-image-non-normative";
574
598
  readonly standardTableImageNormative: "standard-table-image-normative";
575
599
  readonly standardTableNonNormative: "standard-table-non-normative";
@@ -826,6 +850,8 @@ declare const ConfigKey: {
826
850
  readonly property_externalLinkText: "@externalLinkText";
827
851
  readonly property_feedbackEngine: "@feedbackEngine";
828
852
  readonly property_feedbackType: "@feedbackType";
853
+ readonly property_userFeedbackTranslationUrl: "@userFeedbackTranslationUrl";
854
+ readonly property_userFeedbackContentUrl: "@userFeedbackContentUrl";
829
855
  readonly property_flashcardSet: "@flashcardSet";
830
856
  readonly property_focusX: "@focusX";
831
857
  readonly property_focusY: "@focusY";
@@ -1736,6 +1762,8 @@ interface BitJson {
1736
1762
  publisherName: string;
1737
1763
  publications: string | string[];
1738
1764
  relatedBook: string | string[];
1765
+ userFeedbackTranslationUrl: string;
1766
+ userFeedbackContentUrl: string;
1739
1767
  author: string | string[];
1740
1768
  subject: string | string[];
1741
1769
  date: string;
@@ -2357,6 +2385,8 @@ interface Bit {
2357
2385
  publications?: Property;
2358
2386
  relatedBook?: Property;
2359
2387
  translationOfBook?: Property;
2388
+ userFeedbackTranslationUrl?: Property;
2389
+ userFeedbackContentUrl?: Property;
2360
2390
  author?: Property;
2361
2391
  subject?: Property;
2362
2392
  date?: Property;
@@ -3162,6 +3192,10 @@ declare const NodeType: {
3162
3192
  readonly relatedBookValue: "relatedBookValue";
3163
3193
  readonly translationOfBook: "translationOfBook";
3164
3194
  readonly translationOfBookValue: "translationOfBookValue";
3195
+ readonly userFeedbackTranslationUrl: "userFeedbackTranslationUrl";
3196
+ readonly userFeedbackTranslationUrlValue: "userFeedbackTranslationUrlValue";
3197
+ readonly userFeedbackContentUrl: "userFeedbackContentUrl";
3198
+ readonly userFeedbackContentUrlValue: "userFeedbackContentUrlValue";
3165
3199
  readonly releaseDate: "releaseDate";
3166
3200
  readonly releaseDateValue: "releaseDateValue";
3167
3201
  readonly releaseKind: "releaseKind";
@@ -3878,6 +3912,20 @@ type CardSetConfigKeyType = EnumType<typeof CardSetConfigKey>;
3878
3912
  type ExportJsonKey = null | boolean | number | string | ExportJsonKey[] | {
3879
3913
  [k: string]: ExportJsonKey;
3880
3914
  };
3915
+ /**
3916
+ * Key-pattern value for the HTML backend of the key-pattern language.
3917
+ * See crates/lib/jsonkey_parser/doc/HTML.md (design: PLAN-109).
3918
+ *
3919
+ * Structurally identical to {@link ExportJsonKey} (a recursive JSON value) — the
3920
+ * pattern grammar, sigils, and predicates are shared; only the leaf node model
3921
+ * (and HTML-specific reserved keys such as `@el` / `@attr` / `@children` /
3922
+ * `@text`) differ, and those are validated by the new parser's compiler, not
3923
+ * here. Stored verbatim in the raw configs and emitted under the field name
3924
+ * `htmlKey` when writing assets/config/**\/*.jsonc. Omit when absent.
3925
+ */
3926
+ type HtmlKey = null | boolean | number | string | HtmlKey[] | {
3927
+ [k: string]: HtmlKey;
3928
+ };
3881
3929
 
3882
3930
  declare abstract class AbstractTagConfig {
3883
3931
  readonly type: BitTagConfigKeyTypeType;
@@ -3889,6 +3937,8 @@ declare abstract class AbstractTagConfig {
3889
3937
  readonly jsonKey?: string;
3890
3938
  readonly exportJsonKey?: ExportJsonKey;
3891
3939
  readonly hasExportJsonKey: boolean;
3940
+ readonly htmlKey?: HtmlKey;
3941
+ readonly hasHtmlKey: boolean;
3892
3942
  readonly deprecated?: string;
3893
3943
  constructor(params: {
3894
3944
  type: BitTagConfigKeyTypeType;
@@ -3900,6 +3950,8 @@ declare abstract class AbstractTagConfig {
3900
3950
  jsonKey: string | undefined;
3901
3951
  exportJsonKey: ExportJsonKey | undefined;
3902
3952
  hasExportJsonKey: boolean;
3953
+ htmlKey: HtmlKey | undefined;
3954
+ hasHtmlKey: boolean;
3903
3955
  deprecated: string | undefined;
3904
3956
  });
3905
3957
  }
@@ -3919,6 +3971,8 @@ declare class MarkupTagConfig extends AbstractTagConfig {
3919
3971
  jsonKey: string | undefined;
3920
3972
  exportJsonKey: ExportJsonKey | undefined;
3921
3973
  hasExportJsonKey: boolean;
3974
+ htmlKey: HtmlKey | undefined;
3975
+ hasHtmlKey: boolean;
3922
3976
  deprecated: string | undefined;
3923
3977
  });
3924
3978
  toString(options?: ToStringOptions$6): string;
@@ -3943,6 +3997,8 @@ declare class PropertyTagConfig extends AbstractTagConfig {
3943
3997
  jsonKey: string | undefined;
3944
3998
  exportJsonKey: ExportJsonKey | undefined;
3945
3999
  hasExportJsonKey: boolean;
4000
+ htmlKey: HtmlKey | undefined;
4001
+ hasHtmlKey: boolean;
3946
4002
  format: TagFormatType | undefined;
3947
4003
  values: string[] | undefined;
3948
4004
  defaultValue: string | undefined;
@@ -3966,6 +4022,8 @@ declare class ResourceTagConfig extends AbstractTagConfig {
3966
4022
  jsonKey: string | undefined;
3967
4023
  exportJsonKey: ExportJsonKey | undefined;
3968
4024
  hasExportJsonKey: boolean;
4025
+ htmlKey: HtmlKey | undefined;
4026
+ hasHtmlKey: boolean;
3969
4027
  deprecated: string | undefined;
3970
4028
  });
3971
4029
  toString(options?: ToStringOptions$4): string;
@@ -3989,8 +4047,10 @@ declare class CardVariantConfig {
3989
4047
  readonly jsonKey?: string | null;
3990
4048
  readonly exportJsonKey?: ExportJsonKey;
3991
4049
  readonly hasExportJsonKey: boolean;
4050
+ readonly htmlKey?: HtmlKey;
4051
+ readonly hasHtmlKey: boolean;
3992
4052
  readonly format?: TextFormatType;
3993
- constructor(tags: TagsConfig, bodyAllowed?: boolean, bodyRequired?: boolean, repeatCount?: CountType, jsonKey?: string | null, exportJsonKey?: ExportJsonKey, hasExportJsonKey?: boolean, format?: TextFormatType);
4053
+ constructor(tags: TagsConfig, bodyAllowed?: boolean, bodyRequired?: boolean, repeatCount?: CountType, jsonKey?: string | null, exportJsonKey?: ExportJsonKey, hasExportJsonKey?: boolean, format?: TextFormatType, htmlKey?: HtmlKey, hasHtmlKey?: boolean);
3994
4054
  toString(options?: ToStringOptions$3): string;
3995
4055
  }
3996
4056
 
@@ -4004,8 +4064,10 @@ declare class CardSideConfig {
4004
4064
  readonly jsonKey: string | null | undefined;
4005
4065
  readonly exportJsonKey?: ExportJsonKey;
4006
4066
  readonly hasExportJsonKey: boolean;
4067
+ readonly htmlKey?: HtmlKey;
4068
+ readonly hasHtmlKey: boolean;
4007
4069
  readonly variants: CardVariantConfig[];
4008
- constructor(name: string, repeat: boolean, variants: CardVariantConfig[], jsonKey?: string | null, exportJsonKey?: ExportJsonKey, hasExportJsonKey?: boolean);
4070
+ constructor(name: string, repeat: boolean, variants: CardVariantConfig[], jsonKey?: string | null, exportJsonKey?: ExportJsonKey, hasExportJsonKey?: boolean, htmlKey?: HtmlKey, hasHtmlKey?: boolean);
4009
4071
  toString(options?: ToStringOptions$2): string;
4010
4072
  }
4011
4073
 
@@ -4017,10 +4079,14 @@ interface CardSetSection {
4017
4079
  jsonKey: string;
4018
4080
  exportJsonKey?: ExportJsonKey;
4019
4081
  hasExportJsonKey?: boolean;
4082
+ htmlKey?: HtmlKey;
4083
+ hasHtmlKey?: boolean;
4020
4084
  isDefault?: boolean;
4021
4085
  sideJsonKey?: string;
4022
4086
  sideExportJsonKey?: ExportJsonKey;
4023
4087
  hasSideExportJsonKey?: boolean;
4088
+ sideHtmlKey?: HtmlKey;
4089
+ hasSideHtmlKey?: boolean;
4024
4090
  minCount?: number;
4025
4091
  maxCount?: number;
4026
4092
  }
@@ -4029,10 +4095,12 @@ declare class CardSetConfig {
4029
4095
  readonly jsonKey: string | null;
4030
4096
  readonly exportJsonKey?: ExportJsonKey;
4031
4097
  readonly hasExportJsonKey: boolean;
4098
+ readonly htmlKey?: HtmlKey;
4099
+ readonly hasHtmlKey: boolean;
4032
4100
  readonly sections: Record<string, CardSetSection> | undefined;
4033
4101
  readonly sides: CardSideConfig[];
4034
4102
  get variants(): CardVariantConfig[][];
4035
- constructor(configKey: CardSetConfigKeyType, jsonKey: string | null, exportJsonKey: ExportJsonKey | undefined, hasExportJsonKey: boolean, sections: Record<string, CardSetSection> | undefined, sides: CardSideConfig[]);
4103
+ constructor(configKey: CardSetConfigKeyType, jsonKey: string | null, exportJsonKey: ExportJsonKey | undefined, hasExportJsonKey: boolean, sections: Record<string, CardSetSection> | undefined, sides: CardSideConfig[], htmlKey?: HtmlKey | undefined, hasHtmlKey?: boolean);
4036
4104
  toString(options?: ToStringOptions$1): string;
4037
4105
  }
4038
4106
 
@@ -4295,6 +4363,8 @@ declare class Builder extends BaseBuilder {
4295
4363
  publications?: string | string[];
4296
4364
  relatedBook?: string | string[];
4297
4365
  translationOfBook?: string;
4366
+ userFeedbackTranslationUrl?: string;
4367
+ userFeedbackContentUrl?: string;
4298
4368
  author?: string | string[];
4299
4369
  subject?: string | string[];
4300
4370
  date?: string;
@@ -5537,6 +5607,10 @@ interface BitmarkOptions {
5537
5607
  * Generate debug information in the output.
5538
5608
  */
5539
5609
  debugGenerationInline?: boolean;
5610
+ /**
5611
+ * Generate table cell content without breakscaping text.
5612
+ */
5613
+ noBreakscaping?: boolean;
5540
5614
  }
5541
5615
  /**
5542
5616
  * Bitmark generator options
@@ -6066,7 +6140,7 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
6066
6140
  protected enter_caption(node: NodeInfo, route: NodeInfo[]): boolean;
6067
6141
  protected enter_width(node: NodeInfo, route: NodeInfo[]): boolean;
6068
6142
  protected enter_height(node: NodeInfo, route: NodeInfo[]): boolean;
6069
- protected enter_extraProperties(node: NodeInfo, _route: NodeInfo[]): void;
6143
+ protected enter_extraProperties(node: NodeInfo, _route: NodeInfo[]): boolean;
6070
6144
  protected enter_cardBitsValue(node: NodeInfo, route: NodeInfo[]): void;
6071
6145
  protected exit_cardBitsValue(_node: NodeInfo, _route: NodeInfo[]): void;
6072
6146
  protected enter_body(node: NodeInfo, route: NodeInfo[]): boolean;
@@ -6376,6 +6450,71 @@ declare class BitmarkParser {
6376
6450
  toAst(bitmark: string, _options?: BitmarkParserOptions): BitmarkAst;
6377
6451
  }
6378
6452
 
6453
+ /**
6454
+ * Extract HTML tables and convert them into bitmark table bit-JSON.
6455
+ *
6456
+ * Produces an array of bare `BitJson`-shaped objects (`type` = `table-extended` or `table`) that
6457
+ * can be fed directly into the existing JSON → AST → output pipeline. Cell content is built as
6458
+ * `TextAst` (rich text nodes) directly; the downstream generators handle serialisation and
6459
+ * breakscaping.
6460
+ *
6461
+ * See PLAN-013 for the full specification.
6462
+ */
6463
+
6464
+ type HtmlTableFormat = 'table' | 'table-extended';
6465
+ interface HtmlTableParseOptions {
6466
+ /** Output bit type. Default `table-extended` (lossless). `table` is lossy. */
6467
+ tableFormat?: HtmlTableFormat;
6468
+ /** Keep unmappable tags as literal text instead of unwrapping them. Default false. */
6469
+ keepUnknownTags?: boolean;
6470
+ /** Called with a human-readable message when information is lost (e.g. lossy `table` output). */
6471
+ onWarning?: (message: string) => void;
6472
+ }
6473
+ /** Loosely-typed table bit JSON (matches a subset of BitJson). */
6474
+ interface TableBitJson {
6475
+ type: HtmlTableFormat;
6476
+ format: 'bitmark++';
6477
+ caption?: TextAst;
6478
+ table: TableJson | TableExtendedJson;
6479
+ }
6480
+ declare class HtmlTableParser {
6481
+ private keepUnknownTags;
6482
+ /**
6483
+ * Parse an HTML string and return one table bit per top-level `<table>`.
6484
+ */
6485
+ parse(html: string, options?: HtmlTableParseOptions): TableBitJson[];
6486
+ /** Collect every `<table>` element, NOT descending into nested tables. */
6487
+ private collectTopLevelTables;
6488
+ private tableToBit;
6489
+ private rowToCells;
6490
+ private cellToJson;
6491
+ private widthFromCell;
6492
+ private isLossyAsBasic;
6493
+ /**
6494
+ * Convert a cell/li's child nodes into block-level TextAst nodes (paragraphs, lists, images).
6495
+ */
6496
+ private blockNodes;
6497
+ /** Convert child nodes to a flat list of inline TextNodes, applying the given marks. */
6498
+ private inlineNodes;
6499
+ private inlineFromElement;
6500
+ private inlineText;
6501
+ private serializeOpenTag;
6502
+ private isListTag;
6503
+ private listNode;
6504
+ private listType;
6505
+ private listItemNode;
6506
+ private taskItemNode;
6507
+ private imageNode;
6508
+ private isMathTag;
6509
+ private latexNode;
6510
+ private latexFromMath;
6511
+ private findLatexAnnotation;
6512
+ private textContent;
6513
+ private localName;
6514
+ /** Trim leading/trailing whitespace from inline content (edges only). */
6515
+ private trimInline;
6516
+ }
6517
+
6379
6518
  /**
6380
6519
  * Writer to write to a stream.
6381
6520
  */
@@ -6437,65 +6576,6 @@ declare class FileWriter extends StreamWriter {
6437
6576
  close(): Promise<void>;
6438
6577
  }
6439
6578
 
6440
- /**
6441
- * Extract HTML tables and convert them into bitmark table bit-JSON.
6442
- *
6443
- * Produces an array of bare `BitJson`-shaped objects (`type` = `table-extended` or `table`) that
6444
- * can be fed directly into the existing JSON → AST → output pipeline. Cell content is built as
6445
- * `TextAst` (rich text nodes) directly; the downstream generators handle serialisation and
6446
- * breakscaping.
6447
- *
6448
- * See PLAN-013 for the full specification.
6449
- */
6450
-
6451
- type HtmlTableFormat = 'table' | 'table-extended';
6452
- interface HtmlTableParseOptions {
6453
- /** Output bit type. Default `table-extended` (lossless). `table` is lossy. */
6454
- tableFormat?: HtmlTableFormat;
6455
- /** Keep unmappable tags as literal text instead of unwrapping them. Default false. */
6456
- keepUnknownTags?: boolean;
6457
- /** Called with a human-readable message when information is lost (e.g. lossy `table` output). */
6458
- onWarning?: (message: string) => void;
6459
- }
6460
- /** Loosely-typed table bit JSON (matches a subset of BitJson). */
6461
- interface TableBitJson {
6462
- type: HtmlTableFormat;
6463
- format: 'bitmark++';
6464
- caption?: TextAst;
6465
- table: TableJson | TableExtendedJson;
6466
- }
6467
- declare class HtmlTableParser {
6468
- private keepUnknownTags;
6469
- /**
6470
- * Parse an HTML string and return one table bit per top-level `<table>`.
6471
- */
6472
- parse(html: string, options?: HtmlTableParseOptions): TableBitJson[];
6473
- /** Collect every `<table>` element, NOT descending into nested tables. */
6474
- private collectTopLevelTables;
6475
- private tableToBit;
6476
- private rowToCells;
6477
- private cellToJson;
6478
- private widthFromCell;
6479
- private isLossyAsBasic;
6480
- /**
6481
- * Convert a cell/li's child nodes into block-level TextAst nodes (paragraphs, lists, images).
6482
- */
6483
- private blockNodes;
6484
- /** Convert child nodes to a flat list of inline TextNodes, applying the given marks. */
6485
- private inlineNodes;
6486
- private inlineFromElement;
6487
- private inlineText;
6488
- private serializeOpenTag;
6489
- private isListTag;
6490
- private listNode;
6491
- private listType;
6492
- private listItemNode;
6493
- private taskItemNode;
6494
- private imageNode;
6495
- /** Trim leading/trailing whitespace from inline content (edges only). */
6496
- private trimInline;
6497
- }
6498
-
6499
6579
  /**
6500
6580
  * Info options for the parser
6501
6581
  */
@@ -6696,6 +6776,11 @@ interface ConvertHtmlTableOptions {
6696
6776
  * Keep unmappable HTML tags as literal text instead of unwrapping them (HTML -> bits only).
6697
6777
  */
6698
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;
6699
6784
  /**
6700
6785
  * Specify a file to write the output to
6701
6786
  */
@@ -7284,6 +7369,9 @@ declare class HtmlTableGenerator {
7284
7369
  private listTag;
7285
7370
  private listItemToHtml;
7286
7371
  private imageToHtml;
7372
+ private textToHtml;
7373
+ private inlineImageTokenToHtml;
7374
+ private latexToHtml;
7287
7375
  private escapeText;
7288
7376
  private escapeAttr;
7289
7377
  }