@gmb/bitmark-parser-generator 5.1.0 → 5.2.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 [7 Dec 2025 at 21:13]</title>
6
+ <title>@gmb/bitmark-parser-generator [14 Dec 2025 at 22:54]</title>
7
7
  <link rel="shortcut icon" 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/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9Ib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nRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
8
8
 
9
9
  <script>
@@ -31,7 +31,7 @@
31
31
  <body>
32
32
  <div id="app"></div>
33
33
  <script>
34
- window.chartData = [{"label":"bitmark-parser-generator.min.js","isAsset":true,"statSize":1254289,"parsedSize":544466,"gzipSize":105762,"groups":[{"label":"dist/browser/cjs","path":"./dist/browser/cjs","statSize":1248227,"groups":[{"id":922,"label":"index.cjs","path":"./dist/browser/cjs/index.cjs","statSize":1248227,"parsedSize":544362,"gzipSize":105762}],"parsedSize":544362,"gzipSize":105762},{"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}}];
34
+ window.chartData = [{"label":"bitmark-parser-generator.min.js","isAsset":true,"statSize":1256772,"parsedSize":546153,"gzipSize":106168,"groups":[{"label":"dist/browser/cjs","path":"./dist/browser/cjs","statSize":1250710,"groups":[{"id":922,"label":"index.cjs","path":"./dist/browser/cjs/index.cjs","statSize":1250710,"parsedSize":546049,"gzipSize":106168}],"parsedSize":546049,"gzipSize":106168},{"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}}];
35
35
  window.entrypoints = ["main"];
36
36
  window.defaultSizes = "stat";
37
37
  window.compressionAlgorithm = "gzip";
@@ -641,6 +641,7 @@ var BitType = {
641
641
  trueFalse: "true-false",
642
642
  trueFalse1: "true-false-1",
643
643
  vendorAmcharts5Chart: "vendor-amcharts-5-chart",
644
+ vendorDatadogDashboard: "vendor-datadog-dashboard",
644
645
  vendorDatadogDashboardEmbed: "vendor-datadog-dashboard-embed",
645
646
  vendorFormbricksEmbed: "vendor-formbricks-embed",
646
647
  vendorFormbricksLink: "vendor-formbricks-link",
@@ -1280,6 +1281,7 @@ var propertyKeys = {
1280
1281
  property_internalComment: "@internalComment",
1281
1282
  property_internalPrintPdf: "@internalPrintPdf",
1282
1283
  property_hasPrintRestriction: "@hasPrintRestriction",
1284
+ property_enforceUpdateOverUserInput: "@enforceUpdateOverUserInput",
1283
1285
  property_isCaseSensitive: "@isCaseSensitive",
1284
1286
  property_isInfoOnly: "@isInfoOnly",
1285
1287
  property_isPublic: "@isPublic",
@@ -1306,6 +1308,7 @@ var propertyKeys = {
1306
1308
  property_listItemIndent: "@listItemIndent",
1307
1309
  property_location: "@location",
1308
1310
  property_machineTranslated: "@machineTranslated",
1311
+ property_translationOf: "@translationOf",
1309
1312
  property_spansPageBreak: "@spansPageBreak",
1310
1313
  property_mailingList: "@mailingList",
1311
1314
  property_mark: "@mark",
@@ -2793,6 +2796,11 @@ var GROUPS = {
2793
2796
  description: "If true, the bit is machine-translated",
2794
2797
  format: TagFormat.plainText
2795
2798
  },
2799
+ {
2800
+ key: ConfigKey.property_translationOf,
2801
+ description: "Translation source reference",
2802
+ format: TagFormat.plainText
2803
+ },
2796
2804
  {
2797
2805
  key: ConfigKey.property_spansPageBreak,
2798
2806
  description: "If true, the bit spans a page break",
@@ -3443,6 +3451,12 @@ var GROUPS = {
3443
3451
  description: "If true, the book has print restrictions",
3444
3452
  format: TagFormat.boolean,
3445
3453
  defaultValue: "true"
3454
+ },
3455
+ {
3456
+ key: ConfigKey.property_enforceUpdateOverUserInput,
3457
+ description: "If true, prioritize new content over legacy content from the instance API",
3458
+ format: TagFormat.boolean,
3459
+ defaultValue: "false"
3446
3460
  }
3447
3461
  ]
3448
3462
  },
@@ -9631,6 +9645,11 @@ var BITS = {
9631
9645
  description: "AmCharts 5 chart bit, used to embed AmCharts 5 charts in articles or books",
9632
9646
  textFormatDefault: TextFormat2.json
9633
9647
  },
9648
+ [BitType.vendorDatadogDashboard]: {
9649
+ since: "5.2.0",
9650
+ baseBitType: BitType.nonProductionPrototypeIframe,
9651
+ description: "A Datadog dashboard bit, used to embed Datadog dashboards"
9652
+ },
9634
9653
  [BitType.vendorDatadogDashboardEmbed]: {
9635
9654
  since: "3.12.0",
9636
9655
  baseBitType: BitType.code,
@@ -10260,7 +10279,7 @@ var instance2 = new Config();
10260
10279
  // src/generated/package_info.ts
10261
10280
  var PACKAGE_INFO = {
10262
10281
  "name": "@gmb/bitmark-parser-generator",
10263
- "version": "5.1.0",
10282
+ "version": "5.2.0",
10264
10283
  "author": "Get More Brain Ltd",
10265
10284
  "license": "ISC",
10266
10285
  "description": "A bitmark parser and generator using Peggy.js"
@@ -10881,6 +10900,8 @@ var NodeType = {
10881
10900
  internalPrintPdfValue: "internalPrintPdfValue",
10882
10901
  hasPrintRestriction: "hasPrintRestriction",
10883
10902
  hasPrintRestrictionValue: "hasPrintRestrictionValue",
10903
+ enforceUpdateOverUserInput: "enforceUpdateOverUserInput",
10904
+ enforceUpdateOverUserInputValue: "enforceUpdateOverUserInputValue",
10884
10905
  isCaseSensitive: "isCaseSensitive",
10885
10906
  isCommented: "isCommented",
10886
10907
  isCorrect: "isCorrect",
@@ -10947,6 +10968,8 @@ var NodeType = {
10947
10968
  locationValue: "locationValue",
10948
10969
  machineTranslated: "machineTranslated",
10949
10970
  machineTranslatedValue: "machineTranslatedValue",
10971
+ translationOf: "translationOf",
10972
+ translationOfValue: "translationOfValue",
10950
10973
  spansPageBreak: "spansPageBreak",
10951
10974
  spansPageBreakValue: "spansPageBreakValue",
10952
10975
  mailingList: "mailingList",
@@ -12066,7 +12089,7 @@ var Stage = {
12066
12089
  between: "between",
12067
12090
  exit: "exit"
12068
12091
  };
12069
- var TextGenerator = class extends AstWalkerGenerator {
12092
+ var TextGenerator = class _TextGenerator extends AstWalkerGenerator {
12070
12093
  /**
12071
12094
  * Generate text from a bitmark text AST
12072
12095
  *
@@ -12078,6 +12101,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12078
12101
  __publicField(this, "ast", new Ast());
12079
12102
  __publicField(this, "bitmarkVersion");
12080
12103
  __publicField(this, "options");
12104
+ __publicField(this, "internalTextGenerator", null);
12081
12105
  // State
12082
12106
  __publicField(this, "generateOptions", {});
12083
12107
  __publicField(this, "textFormat", TextFormat2.bitmarkText);
@@ -12093,6 +12117,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12093
12117
  __publicField(this, "exitedCodeBlock", false);
12094
12118
  __publicField(this, "inBulletList", false);
12095
12119
  __publicField(this, "inInline", false);
12120
+ __publicField(this, "markDepth", 0);
12096
12121
  __publicField(this, "textDepth", 0);
12097
12122
  __publicField(this, "placeholderIndex", 0);
12098
12123
  __publicField(this, "placeholders", {});
@@ -12117,6 +12142,13 @@ var TextGenerator = class extends AstWalkerGenerator {
12117
12142
  this.between = this.between.bind(this);
12118
12143
  this.exit = this.exit.bind(this);
12119
12144
  this.leaf = this.leaf.bind(this);
12145
+ if (!this.options.isInternal) {
12146
+ this.internalTextGenerator = new _TextGenerator(bitmarkVersion, {
12147
+ ...this.options,
12148
+ writeCallback: void 0,
12149
+ isInternal: true
12150
+ });
12151
+ }
12120
12152
  }
12121
12153
  /**
12122
12154
  * Generate text from a bitmark text AST
@@ -12173,6 +12205,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12173
12205
  this.exitedCodeBlock = false;
12174
12206
  this.inBulletList = false;
12175
12207
  this.inInline = false;
12208
+ this.markDepth = 0;
12176
12209
  this.textDepth = 0;
12177
12210
  this.placeholderIndex = 0;
12178
12211
  this.placeholders = {};
@@ -12220,8 +12253,16 @@ var TextGenerator = class extends AstWalkerGenerator {
12220
12253
  exit_contentValueValue(node, route) {
12221
12254
  return this.handleExitNode(node.value, route);
12222
12255
  }
12256
+ // * -> marks
12257
+ enter_marks(_node, _route) {
12258
+ this.markDepth++;
12259
+ }
12260
+ exit_marks(_node, _route) {
12261
+ this.markDepth--;
12262
+ }
12223
12263
  // END NODE HANDLERS
12224
12264
  handleEnterNode(node, route) {
12265
+ if (this.markDepth > 0) return;
12225
12266
  this.handleEnterNodePreTextCheck(node, route);
12226
12267
  this.handleIndent(node);
12227
12268
  switch (node.type) {
@@ -12232,7 +12273,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12232
12273
  case TextNodeType.hardBreak:
12233
12274
  this.writeHardBreak(node);
12234
12275
  break;
12235
- case TextNodeType.text:
12276
+ case TextNodeType.text: {
12236
12277
  this.writeMarks(node, Stage.enter);
12237
12278
  this.writeText(node);
12238
12279
  this.writeMarks(node, Stage.between);
@@ -12241,6 +12282,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12241
12282
  }
12242
12283
  this.textDepth++;
12243
12284
  break;
12285
+ }
12244
12286
  case TextNodeType.heading:
12245
12287
  this.writeHeading(node);
12246
12288
  this.inHeading = true;
@@ -12291,6 +12333,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12291
12333
  }
12292
12334
  }
12293
12335
  handleExitNode(node, _route) {
12336
+ if (this.markDepth > 0) return;
12294
12337
  switch (node.type) {
12295
12338
  case TextNodeType.text:
12296
12339
  this.textDepth--;
@@ -12597,7 +12640,7 @@ var TextGenerator = class extends AstWalkerGenerator {
12597
12640
  */
12598
12641
  writeMarks(node, stage) {
12599
12642
  if (node.marks) {
12600
- const forceSingleMark = !!(this.inInline || this.inHeading);
12643
+ const forceSingleMark = this.generateOptions.forceInline || !!(this.inInline || this.inHeading);
12601
12644
  this.thisNodeIsPreText = false;
12602
12645
  const emptyMarks = node.marks.length === 0;
12603
12646
  if (emptyMarks) {
@@ -12828,13 +12871,33 @@ var TextGenerator = class extends AstWalkerGenerator {
12828
12871
  s += `|provider:${provider}`;
12829
12872
  this.write(s);
12830
12873
  }
12831
- writeFootnoteMark(_mark) {
12874
+ writeFootnoteMark(mark) {
12832
12875
  const s = `footnote:`;
12833
12876
  this.write(s);
12877
+ const text = this.internalTextGenerator?.generateSync(
12878
+ mark.attrs?.content,
12879
+ this.textFormat,
12880
+ this.textLocation,
12881
+ {
12882
+ ...this.generateOptions,
12883
+ forceInline: true
12884
+ }
12885
+ ) ?? "";
12886
+ this.write(text);
12834
12887
  }
12835
- writeFootnoteStarMark(_mark) {
12888
+ writeFootnoteStarMark(mark) {
12836
12889
  const s = `footnote*:`;
12837
12890
  this.write(s);
12891
+ const text = this.internalTextGenerator?.generateSync(
12892
+ mark.attrs?.content,
12893
+ this.textFormat,
12894
+ this.textLocation,
12895
+ {
12896
+ ...this.generateOptions,
12897
+ forceInline: true
12898
+ }
12899
+ ) ?? "";
12900
+ this.write(text);
12838
12901
  }
12839
12902
  writeSymbolMark(mark) {
12840
12903
  if (mark.attrs == null) return;
@@ -23991,6 +24054,12 @@ var Builder = class extends BaseBuilder {
23991
24054
  data.machineTranslated,
23992
24055
  options
23993
24056
  ),
24057
+ translationOf: this.toAstProperty(
24058
+ bitType,
24059
+ ConfigKey.property_translationOf,
24060
+ data.translationOf,
24061
+ options
24062
+ ),
23994
24063
  spansPageBreak: this.toAstProperty(
23995
24064
  bitType,
23996
24065
  ConfigKey.property_spansPageBreak,
@@ -24707,6 +24776,12 @@ var Builder = class extends BaseBuilder {
24707
24776
  data.hasPrintRestriction,
24708
24777
  options
24709
24778
  ),
24779
+ enforceUpdateOverUserInput: this.toAstProperty(
24780
+ bitType,
24781
+ ConfigKey.property_enforceUpdateOverUserInput,
24782
+ data.enforceUpdateOverUserInput,
24783
+ options
24784
+ ),
24710
24785
  tocResource: this.toAstProperty(
24711
24786
  bitType,
24712
24787
  ConfigKey.property_tocResource,
@@ -30407,6 +30482,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
30407
30482
  if (instance2.isOfBitType(bitType, BitType.book)) {
30408
30483
  if (bitJson.maxTocChapterLevel == null) bitJson.maxTocChapterLevel = -1;
30409
30484
  if (bitJson.hasPrintRestriction == null) bitJson.hasPrintRestriction = true;
30485
+ if (bitJson.enforceUpdateOverUserInput == null) bitJson.enforceUpdateOverUserInput = false;
30410
30486
  if (bitJson.hasMarkAsDone == null) bitJson.hasMarkAsDone = false;
30411
30487
  if (bitJson.processHandIn == null) bitJson.processHandIn = false;
30412
30488
  if (bitJson.isPublic == null) bitJson.isPublic = false;