mathpix-markdown-it 2.0.36 → 2.0.38

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.
Files changed (40) hide show
  1. package/README.md +23 -3
  2. package/doc/changelog.md +48 -0
  3. package/es5/bundle.js +5 -5
  4. package/es5/index.js +5 -5
  5. package/lib/contex-menu/styles.js +2 -1
  6. package/lib/contex-menu/styles.js.map +1 -1
  7. package/lib/copy-to-clipboard/clipboard-copy-styles.js +2 -1
  8. package/lib/copy-to-clipboard/clipboard-copy-styles.js.map +1 -1
  9. package/lib/markdown/md-inline-rule/diagbox-inline.js +46 -46
  10. package/lib/markdown/md-inline-rule/diagbox-inline.js.map +1 -1
  11. package/lib/markdown/md-inline-rule/mmd-icon.js +42 -46
  12. package/lib/markdown/md-inline-rule/mmd-icon.js.map +1 -1
  13. package/lib/mathpix-markdown-model/index.d.ts +34 -5
  14. package/lib/mathpix-markdown-model/index.js +105 -50
  15. package/lib/mathpix-markdown-model/index.js.map +1 -1
  16. package/lib/styles/colors.d.ts +63 -0
  17. package/lib/styles/colors.js +68 -0
  18. package/lib/styles/colors.js.map +1 -0
  19. package/lib/styles/helpers.js +22 -0
  20. package/lib/styles/helpers.js.map +1 -0
  21. package/lib/styles/index.d.ts +4 -3
  22. package/lib/styles/index.js +45 -7
  23. package/lib/styles/index.js.map +1 -1
  24. package/lib/styles/styles-code.d.ts +1 -1
  25. package/lib/styles/styles-code.js +6 -1
  26. package/lib/styles/styles-code.js.map +1 -1
  27. package/lib/styles/styles-container.js +2 -1
  28. package/lib/styles/styles-container.js.map +1 -1
  29. package/lib/styles/styles-lists.d.ts +1 -1
  30. package/lib/styles/styles-lists.js +1 -1
  31. package/lib/styles/styles-lists.js.map +1 -1
  32. package/lib/styles/styles-tabular.d.ts +1 -1
  33. package/lib/styles/styles-tabular.js +5 -2
  34. package/lib/styles/styles-tabular.js.map +1 -1
  35. package/package.json +1 -1
  36. package/pr-specs/2026-03-fix-silent-mode-state-pos.md +103 -0
  37. package/pr-specs/2026-03-mmd-css-scoping.md +267 -0
  38. package/lib/styles/halpers.js +0 -13
  39. package/lib/styles/halpers.js.map +0 -1
  40. /package/lib/styles/{halpers.d.ts → helpers.d.ts} +0 -0
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.menuStyle = void 0;
4
4
  var consts_1 = require("./menu/consts");
5
+ var colors_1 = require("../styles/colors");
5
6
  var menuStyle = function () {
6
- return "\n .mmd-menu {\n max-width: ".concat(consts_1.maxWidthMenu, "px;\n position: absolute;\n background-color: white;\n color: black;\n width: auto;\n padding: ").concat(consts_1.paddingMenu, "px 0px;\n border: 1px solid #E5E6EB;\n margin: 0;\n cursor: default;\n font: menu;\n text-align: left;\n text-indent: 0;\n text-transform: none;\n line-height: normal;\n letter-spacing: normal;\n word-spacing: normal;\n word-wrap: normal;\n white-space: nowrap;\n float: none;\n z-index: 201;\n border-radius: 5px;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n -khtml-border-radius: 5px;\n box-shadow: 0px 10px 20px #808080;\n -webkit-box-shadow: 0px 10px 20px #808080;\n -moz-box-shadow: 0px 10px 20px #808080;\n -khtml-box-shadow: 0px 10px 20px #808080; \n }\n \n .mmd-menu:focus { outline: none; }\n \n .mmd-menu.mmd-menu-sm {\n max-width: 100vw;\n padding-bottom: ").concat(consts_1.paddingMenuBottomSmall, "px;\n border-radius: 0;\n -webkit-border-radius: 0;\n -moz-border-radius: 0;\n -khtml-border-radius: 0;\n }\n\n .mmd-menu-item-icon {\n color: #1e2029;\n margin-left: auto;\n align-items: center;\n display: flex;\n flex-shrink: 0;\n display: none; \n }\n\n .mmd-menu-item {\n padding-bottom: 8px;\n padding-top: 8px;\n padding-left: 1.25rem;\n padding-right: 1.25rem;\n display: flex;\n background: transparent; \n height: ").concat(consts_1.heightMenuItem, "px;\n max-height: ").concat(consts_1.heightMenuItem, "px;\n }\n .mmd-menu-item:focus { outline: none; }\n\n .mmd-menu-item.active {\n background-color: #e1e0e5; \n }\n\n .mmd-menu-item.active .mmd-menu-item-icon {\n display: flex; \n }\n\n .mmd-menu-item-container {\n overflow: hidden; \n }\n\n .mmd-menu-item-title {\n color: #1e2029;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n font-size: 14px;\n line-height: 20px; \n }\n\n .mmd-menu-item-value {\n color: #7d829c;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n font-size: 12px;\n line-height: 16px; \n }\n \n html[data-theme=\"dark\"] .mmd-menu-item-title {\n color: #ebefe7;\n } \n html[data-theme=\"dark\"] .mmd-menu-item.active .mmd-menu-item-title {\n color: #1e2029;\n }\n html[data-theme=\"dark\"] .mmd-menu {\n background-color: #33363a;\n }\n \n .mmd-context-menu-overlay{\n background: rgba(0, 0, 0, 0.56);\n }\n ");
7
+ return "\n.mmd-menu {\n max-width: ".concat(consts_1.maxWidthMenu, "px;\n position: absolute;\n background-color: white;\n color: black;\n width: auto;\n padding: ").concat(consts_1.paddingMenu, "px 0;\n border: 1px solid ").concat(colors_1.COLOR_MENU_BORDER, ";\n margin: 0;\n cursor: default;\n font: menu;\n text-align: left;\n text-indent: 0;\n text-transform: none;\n line-height: normal;\n letter-spacing: normal;\n word-spacing: normal;\n word-wrap: normal;\n white-space: nowrap;\n float: none;\n z-index: 201;\n border-radius: 5px;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n -khtml-border-radius: 5px;\n box-shadow: 0 10px 20px ").concat(colors_1.COLOR_MENU_SHADOW, ";\n -webkit-box-shadow: 0 10px 20px ").concat(colors_1.COLOR_MENU_SHADOW, ";\n -moz-box-shadow: 0 10px 20px ").concat(colors_1.COLOR_MENU_SHADOW, ";\n -khtml-box-shadow: 0 10px 20px ").concat(colors_1.COLOR_MENU_SHADOW, ";\n}\n.mmd-menu:focus { outline: none; }\n.mmd-menu.mmd-menu-sm {\n max-width: 100vw;\n padding-bottom: ").concat(consts_1.paddingMenuBottomSmall, "px;\n border-radius: 0;\n -webkit-border-radius: 0;\n -moz-border-radius: 0;\n -khtml-border-radius: 0;\n}\n.mmd-menu-item-icon {\n color: ").concat(colors_1.COLOR_BODY_TEXT, ";\n margin-left: auto;\n align-items: center;\n display: none;\n flex-shrink: 0;\n}\n.mmd-menu-item {\n padding: 8px 1.25rem;\n display: flex;\n background: transparent;\n height: ").concat(consts_1.heightMenuItem, "px;\n max-height: ").concat(consts_1.heightMenuItem, "px;\n}\n.mmd-menu-item:focus { outline: none; }\n.mmd-menu-item.active {\n background-color: ").concat(colors_1.COLOR_MENU_ITEM_ACTIVE_BG, ";\n}\n.mmd-menu-item.active .mmd-menu-item-icon {\n display: flex;\n}\n.mmd-menu-item-container {\n overflow: hidden;\n}\n.mmd-menu-item-title {\n color: ").concat(colors_1.COLOR_BODY_TEXT, ";\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n font-size: 14px;\n line-height: 20px;\n}\n.mmd-menu-item-value {\n color: ").concat(colors_1.COLOR_MENU_ITEM_VALUE, ";\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n font-size: 12px;\n line-height: 16px;\n}\nhtml[data-theme=\"dark\"] .mmd-menu-item-title {\n color: ").concat(colors_1.COLOR_DARK_MENU_TITLE, ";\n}\nhtml[data-theme=\"dark\"] .mmd-menu-item.active .mmd-menu-item-title {\n color: ").concat(colors_1.COLOR_BODY_TEXT, ";\n}\nhtml[data-theme=\"dark\"] .mmd-menu {\n background-color: ").concat(colors_1.COLOR_DARK_MENU_BG, ";\n}\n.mmd-context-menu-overlay {\n background: ").concat(colors_1.COLOR_MENU_OVERLAY, ";\n}\n");
7
8
  };
8
9
  exports.menuStyle = menuStyle;
9
10
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/contex-menu/styles.ts"],"names":[],"mappings":";;;AAAA,wCAAkG;AAE3F,IAAM,SAAS,GAAG;IACvB,OAAO,0CAEQ,qBAAY,2HAKd,oBAAW,mwBA6BJ,+BAAsB,2eAuB9B,uBAAc,kCACV,uBAAc,i8BA+C7B,CAAA;AACH,CAAC,CAAC;AA7GW,QAAA,SAAS,aA6GpB"}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/contex-menu/styles.ts"],"names":[],"mappings":";;;AAAA,wCAAkG;AAClG,2CAI0B;AAEnB,IAAM,SAAS,GAAG;IACvB,OAAO,sCAEM,qBAAY,iHAKd,oBAAW,wCACF,0BAAiB,uaAkBX,0BAAiB,kDACT,0BAAiB,+CACpB,0BAAiB,iDACf,0BAAiB,uHAKhC,+BAAsB,6JAO/B,wBAAe,yMAUd,uBAAc,gCACV,uBAAc,2GAIR,kCAAyB,0KASpC,wBAAe,uKAQf,8BAAqB,iMAQrB,8BAAqB,oGAGrB,wBAAe,8EAGJ,2BAAkB,8DAGxB,2BAAkB,WAEjC,CAAA;AACD,CAAC,CAAC;AA9FW,QAAA,SAAS,aA8FpB"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.clipboardCopyStyles = void 0;
4
- var clipboardCopyStyles = function () { return "\n.ClipboardButton {\n padding: 0;\n margin: 0.5rem;\n display: inline-block;\n cursor: pointer;\n color: rgb(36, 41, 47);\n background: rgb(246, 248, 250);\n border-radius: 6px;\n border: 1px solid rgba(31, 35, 40, 0.15);\n box-shadow: rgba(31, 35, 40, 0.04) 0 1px 0 0, rgba(255, 255, 255, 0.25) 0 1px 0 0 inset;\n position: relative;\n}\n\n.ClipboardButton:hover {\n background-color: rgb(243, 244, 246);\n border-color: rgba(31, 35, 40, 0.15);\n transition-duration: .1s;\n}\n\ntd .mmd-clipboard-copy-container {\n line-height: 0;\n}\n\ntd .ClipboardButton {\n margin: 1px;\n line-height: 0;\n}\n\ntd .ClipboardButton .mmd-clipboard-icon {\n margin: 1px !important;\n transform: scale(0.6);\n}\n\n.mmd-clipboard-icon {\n fill: currentColor;\n vertical-align: text-bottom;\n}\n\n.mmd-clipboard-copy-icon {\n color: rgb(101, 109, 118);\n}\n.mmd-clipboard-check-icon {\n color: rgb(26, 127, 55);\n}\n\n.mmd-tooltipped-no-delay:hover::before,\n.mmd-tooltipped-no-delay:hover::after {\n animation-delay: 0s;\n}\n\n.mmd-tooltipped:hover::before,\n.mmd-tooltipped:hover::after {\n display: inline-block;\n text-decoration: none;\n animation-name: tooltip-appear;\n animation-duration: .1s;\n animation-fill-mode: forwards;\n animation-timing-function: ease-in;\n animation-delay: .4s;\n}\n\n.mmd-tooltipped-w::before {\n top: 50%;\n bottom: 50%;\n left: -7px;\n margin-top: -6px;\n border-left-color: rgb(36, 41, 47);\n}\n\n.mmd-tooltipped::before {\n position: absolute;\n z-index: 1000001;\n display: none;\n width: 0;\n height: 0;\n color: rgb(36, 41, 47);\n pointer-events: none;\n content: \"\";\n border: 6px solid transparent;\n opacity: 0;\n}\n\n.mmd-tooltipped-w::after {\n right: 100%;\n bottom: 50%;\n margin-right: 6px;\n transform: translateY(50%);\n}\n\n\n.mmd-tooltipped::after {\n position: absolute;\n z-index: 1000000;\n display: none;\n padding: 0.5em 0.75em;\n font: normal normal 11px/1.5 'CMU Serif', 'Georgia', Helvetica, Arial, sans-serif;\n -webkit-font-smoothing: subpixel-antialiased;\n color: rgb(255, 255, 255);\n text-align: center;\n text-decoration: none;\n text-shadow: none;\n text-transform: none;\n letter-spacing: normal;\n word-wrap: break-word;\n white-space: pre;\n pointer-events: none;\n content: attr(aria-label);\n background: rgb(36, 41, 47);\n border-radius: 6px;\n opacity: 0;\n}\n"; };
4
+ var colors_1 = require("../styles/colors");
5
+ var clipboardCopyStyles = function () { return "\n.ClipboardButton {\n padding: 0;\n margin: 0.5rem;\n display: inline-block;\n cursor: pointer;\n color: ".concat(colors_1.COLOR_CLIPBOARD_TEXT, ";\n background: ").concat(colors_1.COLOR_CLIPBOARD_BG, ";\n border-radius: 6px;\n border: 1px solid ").concat(colors_1.COLOR_CLIPBOARD_BORDER, ";\n box-shadow: ").concat(colors_1.COLOR_CLIPBOARD_SHADOW, " 0 1px 0 0, ").concat(colors_1.COLOR_CLIPBOARD_SHADOW_INSET, " 0 1px 0 0 inset;\n position: relative;\n}\n.ClipboardButton:hover {\n background-color: ").concat(colors_1.COLOR_CLIPBOARD_HOVER_BG, ";\n border-color: ").concat(colors_1.COLOR_CLIPBOARD_BORDER, ";\n transition-duration: .1s;\n}\ntd .mmd-clipboard-copy-container {\n line-height: 0;\n}\ntd .ClipboardButton {\n margin: 1px;\n line-height: 0;\n}\ntd .ClipboardButton .mmd-clipboard-icon {\n margin: 1px !important;\n transform: scale(0.6);\n}\n.mmd-clipboard-icon {\n fill: currentColor;\n vertical-align: text-bottom;\n}\n.mmd-clipboard-copy-icon {\n color: ").concat(colors_1.COLOR_CLIPBOARD_COPY_ICON, ";\n}\n.mmd-clipboard-check-icon {\n color: ").concat(colors_1.COLOR_CLIPBOARD_CHECK_ICON, ";\n}\n.mmd-tooltipped-no-delay:hover::before,\n.mmd-tooltipped-no-delay:hover::after {\n animation-delay: 0s;\n}\n.mmd-tooltipped:hover::before,\n.mmd-tooltipped:hover::after {\n display: inline-block;\n text-decoration: none;\n animation-name: tooltip-appear;\n animation-duration: .1s;\n animation-fill-mode: forwards;\n animation-timing-function: ease-in;\n animation-delay: .4s;\n}\n.mmd-tooltipped-w::before {\n top: 50%;\n bottom: 50%;\n left: -7px;\n margin-top: -6px;\n border-left-color: ").concat(colors_1.COLOR_CLIPBOARD_TEXT, ";\n}\n.mmd-tooltipped::before {\n position: absolute;\n z-index: 1000001;\n display: none;\n width: 0;\n height: 0;\n color: ").concat(colors_1.COLOR_CLIPBOARD_TEXT, ";\n pointer-events: none;\n content: \"\";\n border: 6px solid transparent;\n opacity: 0;\n}\n.mmd-tooltipped-w::after {\n right: 100%;\n bottom: 50%;\n margin-right: 6px;\n transform: translateY(50%);\n}\n.mmd-tooltipped::after {\n position: absolute;\n z-index: 1000000;\n display: none;\n padding: 0.5em 0.75em;\n font: normal normal 11px/1.5 'CMU Serif', 'Georgia', Helvetica, Arial, sans-serif;\n -webkit-font-smoothing: subpixel-antialiased;\n color: white;\n text-align: center;\n text-decoration: none;\n text-shadow: none;\n text-transform: none;\n letter-spacing: normal;\n word-wrap: break-word;\n white-space: pre;\n pointer-events: none;\n content: attr(aria-label);\n background: ").concat(colors_1.COLOR_CLIPBOARD_TEXT, ";\n border-radius: 6px;\n opacity: 0;\n}\n"); };
5
6
  exports.clipboardCopyStyles = clipboardCopyStyles;
6
7
  //# sourceMappingURL=clipboard-copy-styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard-copy-styles.js","sourceRoot":"","sources":["../../src/copy-to-clipboard/clipboard-copy-styles.ts"],"names":[],"mappings":";;;AAAO,IAAM,mBAAmB,GAAG,cAAM,OAAA,g4EAgHxC,EAhHwC,CAgHxC,CAAC;AAhHW,QAAA,mBAAmB,uBAgH9B"}
1
+ {"version":3,"file":"clipboard-copy-styles.js","sourceRoot":"","sources":["../../src/copy-to-clipboard/clipboard-copy-styles.ts"],"names":[],"mappings":";;;AAAA,2CAI0B;AAEnB,IAAM,mBAAmB,GAAG,cAAM,OAAA,yHAM9B,6BAAoB,8BACf,2BAAkB,2DAEZ,+BAAsB,8BAC5B,+BAAsB,yBAAe,qCAA4B,wGAI3D,iCAAwB,gCAC5B,+BAAsB,gYAmB7B,kCAAyB,yDAGzB,mCAA0B,2gBAqBd,6BAAoB,gJAQhC,6BAAoB,4tBA6Bf,6BAAoB,iDAInC,EAnGwC,CAmGxC,CAAC;AAnGW,QAAA,mBAAmB,uBAmG9B"}
@@ -46,55 +46,55 @@ var inlineDiagbox = function (state, silent) {
46
46
  match = consts_1.reDiagbox.exec(str);
47
47
  if (!match)
48
48
  return false;
49
- if (silent)
50
- return true;
51
49
  var index = match.index;
52
- var options = match[2] || '';
53
- var isSW = false;
54
- if (match[1] === 'slashbox') {
55
- isSW = true;
56
- }
57
- var attributes = (0, parse_attribures_1.parseAttributes)(options);
58
- if ((attributes === null || attributes === void 0 ? void 0 : attributes.dir) === 'SW' || (attributes === null || attributes === void 0 ? void 0 : attributes.dir) === 'NE') {
59
- isSW = true;
60
- }
61
50
  var _a = tslib_1.__read((0, sub_cell_1.extractNextBraceContent)(str, index + match[0].length), 2), left = _a[0], newIndex = _a[1];
62
51
  var _b = tslib_1.__read((0, sub_cell_1.extractNextBraceContent)(str, newIndex), 2), right = _b[0], endIndex = _b[1];
63
- left = left ? (0, sub_math_1.getSubMath)(left) : '';
64
- right = right ? (0, sub_math_1.getSubMath)(right) : '';
65
- left = left.split('\n').join('').trim();
66
- right = right.split('\n').join('').trim();
67
- left = left.split('\\\\').join('\n');
68
- right = right.split('\\\\').join('\n');
69
- var token = isSW ? state.push('slashbox', '', 0) : state.push('backslashbox', '', 0);
70
- token.attrJoin('class', "diagonal-cell");
71
- token.attrJoin('style', 'grid-template-columns: repeat(2, 1fr); padding: 0;');
72
- token.content = '';
73
- token.latex = match[0];
74
- token.children = [];
75
- var leftContent = processContent(left);
76
- var rightContent = processContent(right);
77
- var tokenLeft = createDiagboxItemToken(state, leftContent);
78
- var tokenRight = createDiagboxItemToken(state, rightContent);
79
- if (isSW) {
80
- tokenLeft.attrJoin('class', "cell-item diagonal-cell-topLeft");
81
- var styleTopLeft = ['grid-row-start: 1;', 'grid-column-start: 1;', 'text-align: left; white-space: nowrap; min-height: 1.5em;'];
82
- tokenLeft.attrJoin('style', styleTopLeft.join(' '));
83
- token.children.push(tokenLeft);
84
- tokenRight.attrJoin('class', "cell-item diagonal-cell-bottomRight");
85
- var styleBottomRight = ['grid-row-start: 2;', 'grid-column-start: 2;', 'text-align: right; white-space: nowrap; min-height: 1.5em; margin-top: auto;'];
86
- tokenRight.attrJoin('style', styleBottomRight.join(' '));
87
- token.children.push(tokenRight);
88
- }
89
- else {
90
- tokenRight.attrJoin('class', "cell-item diagonal-cell-topRight");
91
- var styleTopRight = ['grid-row-start: 1;', 'grid-column-start: 2;', 'text-align: right; white-space: nowrap; min-height: 1.5em;'];
92
- tokenRight.attrJoin('style', styleTopRight.join(' '));
93
- token.children.push(tokenRight);
94
- tokenLeft.attrJoin('class', "cell-item diagonal-cell-bottomLeft");
95
- var styleBottomLeft = ['grid-row-start: 2;', 'grid-column-start: 1;', 'text-align: left; white-space: nowrap; min-height: 1.5em; margin-top: auto;'];
96
- tokenLeft.attrJoin('style', styleBottomLeft.join(' '));
97
- token.children.push(tokenLeft);
52
+ if (!silent) {
53
+ var options = match[2] || '';
54
+ var isSW = false;
55
+ if (match[1] === 'slashbox') {
56
+ isSW = true;
57
+ }
58
+ var attributes = (0, parse_attribures_1.parseAttributes)(options);
59
+ if ((attributes === null || attributes === void 0 ? void 0 : attributes.dir) === 'SW' || (attributes === null || attributes === void 0 ? void 0 : attributes.dir) === 'NE') {
60
+ isSW = true;
61
+ }
62
+ left = left ? (0, sub_math_1.getSubMath)(left) : '';
63
+ right = right ? (0, sub_math_1.getSubMath)(right) : '';
64
+ left = left.split('\n').join('').trim();
65
+ right = right.split('\n').join('').trim();
66
+ left = left.split('\\\\').join('\n');
67
+ right = right.split('\\\\').join('\n');
68
+ var token = isSW ? state.push('slashbox', '', 0) : state.push('backslashbox', '', 0);
69
+ token.attrJoin('class', "diagonal-cell");
70
+ token.attrJoin('style', 'grid-template-columns: repeat(2, 1fr); padding: 0;');
71
+ token.content = '';
72
+ token.latex = match[0];
73
+ token.children = [];
74
+ var leftContent = processContent(left);
75
+ var rightContent = processContent(right);
76
+ var tokenLeft = createDiagboxItemToken(state, leftContent);
77
+ var tokenRight = createDiagboxItemToken(state, rightContent);
78
+ if (isSW) {
79
+ tokenLeft.attrJoin('class', "cell-item diagonal-cell-topLeft");
80
+ var styleTopLeft = ['grid-row-start: 1;', 'grid-column-start: 1;', 'text-align: left; white-space: nowrap; min-height: 1.5em;'];
81
+ tokenLeft.attrJoin('style', styleTopLeft.join(' '));
82
+ token.children.push(tokenLeft);
83
+ tokenRight.attrJoin('class', "cell-item diagonal-cell-bottomRight");
84
+ var styleBottomRight = ['grid-row-start: 2;', 'grid-column-start: 2;', 'text-align: right; white-space: nowrap; min-height: 1.5em; margin-top: auto;'];
85
+ tokenRight.attrJoin('style', styleBottomRight.join(' '));
86
+ token.children.push(tokenRight);
87
+ }
88
+ else {
89
+ tokenRight.attrJoin('class', "cell-item diagonal-cell-topRight");
90
+ var styleTopRight = ['grid-row-start: 1;', 'grid-column-start: 2;', 'text-align: right; white-space: nowrap; min-height: 1.5em;'];
91
+ tokenRight.attrJoin('style', styleTopRight.join(' '));
92
+ token.children.push(tokenRight);
93
+ tokenLeft.attrJoin('class', "cell-item diagonal-cell-bottomLeft");
94
+ var styleBottomLeft = ['grid-row-start: 2;', 'grid-column-start: 1;', 'text-align: left; white-space: nowrap; min-height: 1.5em; margin-top: auto;'];
95
+ tokenLeft.attrJoin('style', styleBottomLeft.join(' '));
96
+ token.children.push(tokenLeft);
97
+ }
98
98
  }
99
99
  state.pos += endIndex;
100
100
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"diagbox-inline.js","sourceRoot":"","sources":["../../../src/markdown/md-inline-rule/diagbox-inline.ts"],"names":[],"mappings":";;;;AACA,oEAAkF;AAClF,0EAA2E;AAC3E,oEAA0F;AAC1F,gEAAmE;AACnE,2CAA6C;AAE7C,+DAA6D;AAC7D,oEAAuF;AAEvF,IAAM,cAAc,GAAG,UAAC,OAAe;IACrC,IAAI;QACF,IAAM,SAAS,GAAW,IAAA,8BAAmB,EAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC1D,IAAI,gBAAgB,GAAW,SAAS,IAAI,IAAA,mBAAU,EAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAC7E,IAAM,IAAI,GAAoB,IAAA,2BAAa,EAAC,gBAAgB,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QACvE,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE;YACvB,OAAO,IAAI,CAAC,GAAG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AAa,CAAC,oBAAoB,EAAE,uBAAuB,EAAE,6EAA6E,CAAC,CAAC;gBAC/J,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;gBACvD,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aAChC;SACF;QAED,KAAK,CAAC,GAAG,IAAI,QAAQ,CAAC;QACtB,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;QACjD,OAAO,KAAK,CAAC;KACd;AACH,CAAC,CAAC;AA1EW,QAAA,aAAa,iBA0ExB"}
@@ -6,60 +6,56 @@ var inlineMmdIcon = function (state, silent) {
6
6
  var _a, _b;
7
7
  try {
8
8
  var pos = state.pos, src = state.src;
9
- var match = void 0;
10
9
  if (src.charCodeAt(pos) !== 0x5c /* \ */) {
11
10
  return false;
12
11
  }
13
12
  var reIcon = /^(?:\\icon\{([^}]*)\})/;
14
- match = src.slice(pos).match(reIcon);
13
+ var match = src.slice(pos).match(reIcon);
15
14
  if (!match)
16
15
  return false;
17
- if (silent)
18
- return true;
19
- var iconName = ((_a = match[1]) === null || _a === void 0 ? void 0 : _a.trim()) || '';
20
- var token = void 0;
21
- if (!iconName) {
22
- token = state.push('text', '', 0);
23
- token.content = '';
24
- token.latex = match[0];
25
- state.pos = pos + match.index + match[0].length;
26
- return true;
27
- }
28
- var _c = (0, icons_1.findIcon)(iconName), _d = _c.icon, icon = _d === void 0 ? null : _d, _e = _c.name, name_1 = _e === void 0 ? '' : _e, _f = _c.color, color = _f === void 0 ? '' : _f, _g = _c.isSquared, isSquared = _g === void 0 ? false : _g;
29
- if (!name_1) {
30
- token = state.push('text', '', 0);
31
- token.content = '';
32
- token.latex = match[0];
33
- state.pos = pos + match.index + match[0].length;
34
- return true;
35
- }
36
- if (!icon) {
37
- token = state.push('text_error', '', 0);
38
- token.content = "The icon name \"".concat(iconName, "\" can't be found.");
39
- state.pos = pos + match.index + match[0].length;
40
- return true;
41
- }
42
- if (isSquared) {
43
- token = state.push('text_icon', '', 0);
44
- token.attrJoin('style', "border: 1px solid; width: 1em; height: 1em; display: inline-block; text-align: center; line-height: 1em;");
45
- if (color) {
46
- token.attrJoin('style', "color: ".concat(color, ";"));
16
+ var endPos = pos + match.index + match[0].length;
17
+ if (!silent) {
18
+ var iconName = ((_a = match[1]) === null || _a === void 0 ? void 0 : _a.trim()) || '';
19
+ var token = void 0;
20
+ if (!iconName) {
21
+ token = state.push('text', '', 0);
22
+ token.content = '';
23
+ token.latex = match[0];
24
+ }
25
+ else {
26
+ var _c = (0, icons_1.findIcon)(iconName), _d = _c.icon, icon = _d === void 0 ? null : _d, _e = _c.name, name_1 = _e === void 0 ? '' : _e, _f = _c.color, color = _f === void 0 ? '' : _f, _g = _c.isSquared, isSquared = _g === void 0 ? false : _g;
27
+ if (!name_1) {
28
+ token = state.push('text', '', 0);
29
+ token.content = '';
30
+ token.latex = match[0];
31
+ }
32
+ else if (!icon) {
33
+ token = state.push('text_error', '', 0);
34
+ token.content = "The icon name \"".concat(iconName, "\" can't be found.");
35
+ }
36
+ else if (isSquared) {
37
+ token = state.push('text_icon', '', 0);
38
+ token.attrJoin('style', "border: 1px solid; width: 1em; height: 1em; display: inline-block; text-align: center; line-height: 1em;");
39
+ if (color) {
40
+ token.attrJoin('style', "color: ".concat(color, ";"));
41
+ }
42
+ token.content = icon.symbol;
43
+ token.latex = match[0];
44
+ }
45
+ else {
46
+ token = state.push('text_icon', '', 0);
47
+ token.content = icon.symbol;
48
+ if (color) {
49
+ token.attrJoin('style', "color: ".concat(color, ";"));
50
+ }
51
+ if (((_b = icon.name) === null || _b === void 0 ? void 0 : _b.indexOf('fa_')) !== -1) {
52
+ token.attrJoin('style', 'vertical-align: middle;');
53
+ }
54
+ token.latex = match[0];
55
+ }
47
56
  }
48
- token.content = icon.symbol;
49
- token.latex = match[0];
50
- state.pos = pos + match.index + match[0].length;
51
- return true;
52
- }
53
- token = state.push('text_icon', '', 0);
54
- token.content = icon.symbol;
55
- if (color) {
56
- token.attrJoin('style', "color: ".concat(color, ";"));
57
- }
58
- if (((_b = icon.name) === null || _b === void 0 ? void 0 : _b.indexOf('fa_')) !== -1) {
59
- token.attrJoin('style', 'vertical-align: middle;');
60
57
  }
61
- token.latex = match[0];
62
- state.pos = pos + match.index + match[0].length;
58
+ state.pos = endPos;
63
59
  return true;
64
60
  }
65
61
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"mmd-icon.js","sourceRoot":"","sources":["../../../src/markdown/md-inline-rule/mmd-icon.ts"],"names":[],"mappings":";;;AACA,6CAA+C;AAExC,IAAM,aAAa,GAAe,UAAC,KAAK,EAAE,MAAM;;IACrD,IAAI;QACM,IAAA,GAAG,GAAU,KAAK,IAAf,EAAE,GAAG,GAAK,KAAK,IAAV,CAAW;QAC3B,IAAI,KAAK,SAAiB,CAAC;QAC3B,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE;YACxC,OAAO,KAAK,CAAC;SACd;QAED,IAAM,MAAM,GAAW,wBAAwB,CAAC;QAChD,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC;QAEzB,IAAI,MAAM;YAAE,OAAO,IAAI,CAAC;QAExB,IAAI,QAAQ,GAAG,CAAA,MAAA,KAAK,CAAC,CAAC,CAAC,0CAAE,IAAI,EAAE,KAAI,EAAE,CAAC;QACtC,IAAI,KAAK,SAAO,CAAC;QACjB,IAAI,CAAC,QAAQ,EAAE;YACb,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAClC,KAAK,CAAC,OAAO,GAAG,EAAE,CA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C,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;iBACxB;aACF;SACF;QAED,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC;QACnB,OAAO,IAAI,CAAC;KAEb;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;QACjD,OAAO,KAAK,CAAC;KACd;AACH,CAAC,CAAA;AA1DY,QAAA,aAAa,iBA0DzB"}
@@ -2,6 +2,20 @@ import { Property } from 'csstype';
2
2
  import { ISmilesOptions } from '../markdown/md-chemistry';
3
3
  import { IFontMetricsOptions } from "../markdown/common/text-dimentions";
4
4
  import { size, ISize } from "../markdown/common/counters";
5
+ export interface StyleBundleOpts {
6
+ setTextAlignJustify?: boolean;
7
+ useColors?: boolean;
8
+ maxWidth?: string;
9
+ isPptx?: boolean;
10
+ resetBody?: boolean;
11
+ container?: boolean;
12
+ mathjax?: boolean;
13
+ code?: boolean;
14
+ preview?: boolean;
15
+ toc?: boolean;
16
+ tocContainerName?: string;
17
+ menu?: boolean;
18
+ }
5
19
  export interface optionsMathpixMarkdown {
6
20
  alignMathBlock?: Property.TextAlign;
7
21
  display?: Property.Display;
@@ -208,6 +222,7 @@ declare class MathpixMarkdown_Model {
208
222
  disableRules: string[];
209
223
  isCheckFormula?: boolean;
210
224
  showTimeLog?: boolean;
225
+ private isClickHandlerBound;
211
226
  setOptions(disableRules: string[], isCheckFormula?: boolean, showTimeLog?: boolean): void;
212
227
  checkFormula: (mathString: string, showTimeLog?: boolean) => string;
213
228
  texReset: (n?: number) => void;
@@ -232,12 +247,26 @@ declare class MathpixMarkdown_Model {
232
247
  checkEquationNumber: (html: string) => string;
233
248
  handleClick: (e: any) => void;
234
249
  scrollPage: (parent: any, offsetTarget: any) => void;
235
- loadMathJax: (notScrolling?: boolean, setTextAlignJustify?: boolean, isResetBodyStyles?: boolean, maxWidth?: string, scaleEquation?: boolean) => boolean;
250
+ /** Browser runtime: injects SVG-styles + Mathpix-styles into DOM. Includes: core, code, tabular, lists, toc, menu. No container/mathjax (SVG injected separately). */
251
+ loadMathJax: (notScrolling?: boolean, setTextAlignJustify?: boolean, isResetBodyStyles?: boolean, maxWidth?: string, useColors?: boolean) => boolean;
236
252
  convertToHTML: (str: string, options?: TMarkdownItOptions) => string;
237
- getMathjaxStyle: () => any;
238
- getMathpixStyleOnly: (scaleEquation?: boolean) => string;
239
- getMathpixStyle: (stylePreview?: boolean, showToc?: boolean, tocContainerName?: string, scaleEquation?: boolean, isPptx?: boolean) => string;
240
- getMathpixMarkdownStyles: (useColors?: boolean, scaleEquation?: boolean) => string;
253
+ getMathjaxStyle: () => string;
254
+ /**
255
+ * Single CSS builder. All style assembly methods delegate here.
256
+ *
257
+ * Canonical order:
258
+ * resetBody → container → mathjax → MathpixStyle → code → tabular → lists → preview → toc → menu+clipboard
259
+ *
260
+ * Modules always included: MathpixStyle, tabularStyles, listsStyles.
261
+ * Modules toggled via opts: resetBody, container, mathjax, code (default: on), preview, toc, menu+clipboard.
262
+ */
263
+ buildStyles: (opts?: StyleBundleOpts) => string;
264
+ /** Styles for embedded widget (no container/preview). Includes: mathjax, core, code, tabular, lists, menu.*/
265
+ getMathpixStyleOnly: (useColors?: boolean) => string;
266
+ /** Full page styles. Includes: container, mathjax, core, code, tabular, lists. Optionally: preview, toc, menu.*/
267
+ getMathpixStyle: (stylePreview?: boolean, showToc?: boolean, tocContainerName?: string, useColors?: boolean, isPptx?: boolean) => string;
268
+ /** VSCode markdown preview styles. Includes: container, mathjax, core, tabular, lists. No code (VSCode provides its own).*/
269
+ getMathpixMarkdownStyles: (useColors?: boolean) => string;
241
270
  getMathpixFontsStyle: () => string;
242
271
  render: (text: string, options?: optionsMathpixMarkdown) => string;
243
272
  mmdYamlToHTML: (mmd: string, options?: TMarkdownItOptions, isAddYamlToHtml?: boolean) => {
@@ -12,7 +12,7 @@ var styles_lists_1 = require("../styles/styles-lists");
12
12
  var mathjax_1 = require("../mathjax");
13
13
  var yaml_parser_1 = require("../yaml-parser");
14
14
  var html_page_1 = require("./html-page");
15
- var halpers_1 = require("../styles/halpers");
15
+ var helpers_1 = require("../styles/helpers");
16
16
  var parse_mmd_element_1 = require("../helpers/parse-mmd-element");
17
17
  var styles_2 = require("../contex-menu/styles");
18
18
  var clipboard_copy_styles_1 = require("../copy-to-clipboard/clipboard-copy-styles");
@@ -37,10 +37,11 @@ var MathpixMarkdown_Model = /** @class */ (function () {
37
37
  function MathpixMarkdown_Model() {
38
38
  var _this = this;
39
39
  this.disableFancyArrayDef = ['replacements', 'list', 'usepackage', 'toc'];
40
+ this.isClickHandlerBound = false;
40
41
  this.checkFormula = check_formula_1.checkFormula;
41
42
  this.texReset = mathjax_1.MathJax.Reset;
42
43
  this.getLastEquationNumber = mathjax_1.MathJax.GetLastEquationNumber;
43
- this.getMaxWidthStyle = halpers_1.getMaxWidthStyle;
44
+ this.getMaxWidthStyle = helpers_1.getMaxWidthStyle;
44
45
  this.parseMarkdownByHTML = function (html, include_sub_math) {
45
46
  if (include_sub_math === void 0) { include_sub_math = true; }
46
47
  var parser = new DOMParser();
@@ -90,7 +91,12 @@ var MathpixMarkdown_Model = /** @class */ (function () {
90
91
  ? htmlWrapper.title
91
92
  : '';
92
93
  var styles = htmlWrapper.includeStyles
93
- ? "<style>".concat(_this.getMathpixStyle(true), "</style>")
94
+ ? "<style>".concat(_this.buildStyles({
95
+ container: true,
96
+ mathjax: true,
97
+ preview: true,
98
+ menu: true,
99
+ }), "</style>")
94
100
  : '';
95
101
  var fonts = htmlWrapper.includeFonts
96
102
  ? '<link rel="stylesheet" href="https://cdn.mathpix.com/fonts/cmu.css"/>'
@@ -212,34 +218,41 @@ var MathpixMarkdown_Model = /** @class */ (function () {
212
218
  }
213
219
  }, 10);
214
220
  };
215
- this.loadMathJax = function (notScrolling, setTextAlignJustify, isResetBodyStyles, maxWidth, scaleEquation) {
221
+ /** Browser runtime: injects SVG-styles + Mathpix-styles into DOM. Includes: core, code, tabular, lists, toc, menu. No container/mathjax (SVG injected separately). */
222
+ this.loadMathJax = function (notScrolling, setTextAlignJustify, isResetBodyStyles, maxWidth, useColors) {
216
223
  if (notScrolling === void 0) { notScrolling = false; }
217
224
  if (setTextAlignJustify === void 0) { setTextAlignJustify = false; }
218
225
  if (isResetBodyStyles === void 0) { isResetBodyStyles = false; }
219
226
  if (maxWidth === void 0) { maxWidth = ''; }
220
- if (scaleEquation === void 0) { scaleEquation = true; }
227
+ if (useColors === void 0) { useColors = true; }
221
228
  try {
222
229
  var el = document.getElementById('SVG-styles');
223
230
  if (!el) {
224
231
  var MathJaxStyle = mathjax_1.MathJax.Stylesheet();
225
232
  document.head.appendChild(MathJaxStyle);
226
233
  }
227
- var elStyle = document.getElementById('Mathpix-styles');
228
- if (!notScrolling) {
234
+ if (!notScrolling && !_this.isClickHandlerBound) {
229
235
  window.addEventListener('click', _this.handleClick, false);
236
+ _this.isClickHandlerBound = true;
237
+ }
238
+ var newStyles = _this.buildStyles({
239
+ setTextAlignJustify: setTextAlignJustify,
240
+ useColors: useColors,
241
+ maxWidth: maxWidth,
242
+ resetBody: isResetBodyStyles,
243
+ toc: true,
244
+ menu: true,
245
+ });
246
+ var elStyle = document.getElementById('Mathpix-styles');
247
+ if (elStyle) {
248
+ if (elStyle.innerHTML !== newStyles) {
249
+ elStyle.innerHTML = newStyles;
250
+ }
230
251
  }
231
- if (!elStyle) {
252
+ else {
232
253
  var style = document.createElement("style");
233
254
  style.setAttribute("id", "Mathpix-styles");
234
- var bodyStyles = isResetBodyStyles ? styles_1.resetBodyStyles : '';
235
- style.innerHTML = bodyStyles
236
- + (0, styles_1.MathpixStyle)(setTextAlignJustify, true, maxWidth, scaleEquation)
237
- + styles_code_1.codeStyles
238
- + (0, styles_tabular_1.tabularStyles)()
239
- + styles_lists_1.listsStyles
240
- + (0, styles_1.TocStyle)("toc")
241
- + (0, styles_2.menuStyle)()
242
- + (0, clipboard_copy_styles_1.clipboardCopyStyles)();
255
+ style.innerHTML = newStyles;
243
256
  document.head.appendChild(style);
244
257
  }
245
258
  return true;
@@ -278,42 +291,82 @@ var MathpixMarkdown_Model = /** @class */ (function () {
278
291
  return '';
279
292
  }
280
293
  };
281
- this.getMathpixStyleOnly = function (scaleEquation) {
282
- if (scaleEquation === void 0) { scaleEquation = true; }
283
- var style = _this.getMathjaxStyle()
284
- + (0, styles_1.MathpixStyle)(false, true, '', scaleEquation)
285
- + styles_code_1.codeStyles
286
- + (0, styles_tabular_1.tabularStyles)()
287
- + styles_lists_1.listsStyles
288
- + (0, styles_2.menuStyle)()
289
- + (0, clipboard_copy_styles_1.clipboardCopyStyles)();
290
- return style;
294
+ /**
295
+ * Single CSS builder. All style assembly methods delegate here.
296
+ *
297
+ * Canonical order:
298
+ * resetBody → container → mathjax → MathpixStyle → code → tabular → lists → preview → toc → menu+clipboard
299
+ *
300
+ * Modules always included: MathpixStyle, tabularStyles, listsStyles.
301
+ * Modules toggled via opts: resetBody, container, mathjax, code (default: on), preview, toc, menu+clipboard.
302
+ */
303
+ this.buildStyles = function (opts) {
304
+ if (opts === void 0) { opts = {}; }
305
+ var _a = opts.setTextAlignJustify, setTextAlignJustify = _a === void 0 ? false : _a, _b = opts.useColors, useColors = _b === void 0 ? true : _b, _c = opts.maxWidth, maxWidth = _c === void 0 ? '' : _c, _d = opts.isPptx, isPptx = _d === void 0 ? false : _d, _e = opts.resetBody, resetBody = _e === void 0 ? false : _e, _f = opts.container, container = _f === void 0 ? false : _f, _g = opts.mathjax, mathjax = _g === void 0 ? false : _g, _h = opts.code, code = _h === void 0 ? true : _h, _j = opts.preview, preview = _j === void 0 ? false : _j, _k = opts.toc, toc = _k === void 0 ? false : _k, _l = opts.tocContainerName, tocContainerName = _l === void 0 ? 'toc' : _l, _m = opts.menu, menu = _m === void 0 ? false : _m;
306
+ var parts = [];
307
+ if (resetBody) {
308
+ parts.push(styles_1.resetBodyStyles);
309
+ }
310
+ if (container) {
311
+ parts.push((0, styles_container_1.ContainerStyle)(useColors));
312
+ }
313
+ if (mathjax) {
314
+ parts.push(_this.getMathjaxStyle());
315
+ }
316
+ parts.push((0, styles_1.MathpixStyle)(setTextAlignJustify, useColors, maxWidth, isPptx));
317
+ if (code) {
318
+ parts.push((0, styles_code_1.codeStyles)(useColors));
319
+ }
320
+ parts.push((0, styles_tabular_1.tabularStyles)(useColors, isPptx));
321
+ parts.push(styles_lists_1.listsStyles);
322
+ if (preview) {
323
+ parts.push(styles_1.PreviewStyle);
324
+ }
325
+ if (toc) {
326
+ parts.push((0, styles_1.TocStyle)(tocContainerName));
327
+ }
328
+ if (menu) {
329
+ parts.push((0, styles_2.menuStyle)());
330
+ parts.push((0, clipboard_copy_styles_1.clipboardCopyStyles)());
331
+ }
332
+ return parts.map(function (s) { return s.trim(); }).join('\n');
291
333
  };
292
- this.getMathpixStyle = function (stylePreview, showToc, tocContainerName, scaleEquation, isPptx) {
334
+ /** Styles for embedded widget (no container/preview). Includes: mathjax, core, code, tabular, lists, menu.*/
335
+ this.getMathpixStyleOnly = function (useColors) {
336
+ if (useColors === void 0) { useColors = true; }
337
+ return _this.buildStyles({
338
+ useColors: useColors,
339
+ mathjax: true,
340
+ menu: true,
341
+ });
342
+ };
343
+ /** Full page styles. Includes: container, mathjax, core, code, tabular, lists. Optionally: preview, toc, menu.*/
344
+ this.getMathpixStyle = function (stylePreview, showToc, tocContainerName, useColors, isPptx) {
293
345
  if (stylePreview === void 0) { stylePreview = false; }
294
346
  if (showToc === void 0) { showToc = false; }
295
347
  if (tocContainerName === void 0) { tocContainerName = 'toc'; }
296
- if (scaleEquation === void 0) { scaleEquation = true; }
348
+ if (useColors === void 0) { useColors = true; }
297
349
  if (isPptx === void 0) { isPptx = false; }
298
- var style = (0, styles_container_1.ContainerStyle)() + _this.getMathjaxStyle() + (0, styles_1.MathpixStyle)(false, true, '', scaleEquation, isPptx) + styles_code_1.codeStyles + (0, styles_tabular_1.tabularStyles)() + styles_lists_1.listsStyles;
299
- if (showToc) { }
300
- if (!stylePreview) {
301
- return style;
302
- }
303
- return showToc
304
- ? style + styles_1.PreviewStyle + (0, styles_1.TocStyle)(tocContainerName) + (0, styles_2.menuStyle)() + (0, clipboard_copy_styles_1.clipboardCopyStyles)()
305
- : style + styles_1.PreviewStyle + (0, styles_2.menuStyle)() + (0, clipboard_copy_styles_1.clipboardCopyStyles)();
350
+ return _this.buildStyles({
351
+ useColors: useColors,
352
+ isPptx: isPptx,
353
+ tocContainerName: tocContainerName,
354
+ container: true,
355
+ mathjax: true,
356
+ preview: stylePreview,
357
+ toc: stylePreview && showToc,
358
+ menu: stylePreview,
359
+ });
306
360
  };
307
- this.getMathpixMarkdownStyles = function (useColors, scaleEquation) {
361
+ /** VSCode markdown preview styles. Includes: container, mathjax, core, tabular, lists. No code (VSCode provides its own).*/
362
+ this.getMathpixMarkdownStyles = function (useColors) {
308
363
  if (useColors === void 0) { useColors = true; }
309
- if (scaleEquation === void 0) { scaleEquation = true; }
310
- var style = (0, styles_container_1.ContainerStyle)(useColors);
311
- style += _this.getMathjaxStyle();
312
- style += (0, styles_1.MathpixStyle)(false, useColors, '', scaleEquation = true);
313
- // style += codeStyles;
314
- style += (0, styles_tabular_1.tabularStyles)(useColors);
315
- style += styles_lists_1.listsStyles;
316
- return style;
364
+ return _this.buildStyles({
365
+ useColors: useColors,
366
+ container: true,
367
+ mathjax: true,
368
+ code: false,
369
+ });
317
370
  };
318
371
  this.getMathpixFontsStyle = function () {
319
372
  return styles_fonts_1.fontsStyles;
@@ -322,13 +375,15 @@ var MathpixMarkdown_Model = /** @class */ (function () {
322
375
  var _a = options || {}, _b = _a.alignMathBlock, alignMathBlock = _b === void 0 ? 'center' : _b, _c = _a.display, display = _c === void 0 ? 'block' : _c, _d = _a.isCheckFormula, isCheckFormula = _d === void 0 ? false : _d, _e = _a.showTimeLog, showTimeLog = _e === void 0 ? false : _e, _f = _a.isDisableFancy, isDisableFancy = _f === void 0 ? false : _f, _g = _a.isDisableEmoji, isDisableEmoji = _g === void 0 ? false : _g, _h = _a.isDisableEmojiShortcuts, isDisableEmojiShortcuts = _h === void 0 ? false : _h, _j = _a.isDisableRefs, isDisableRefs = _j === void 0 ? false : _j, _k = _a.isDisableFootnotes, isDisableFootnotes = _k === void 0 ? false : _k, _l = _a.fontSize, fontSize = _l === void 0 ? null : _l, _m = _a.padding, padding = _m === void 0 ? null : _m, _o = _a.htmlTags, htmlTags = _o === void 0 ? false : _o, _p = _a.htmlDisableTagMatching, htmlDisableTagMatching = _p === void 0 ? false : _p, _q = _a.width, width = _q === void 0 ? 0 : _q, _r = _a.showToc, showToc = _r === void 0 ? false : _r, _s = _a.overflowY, overflowY = _s === void 0 ? 'unset' : _s, _t = _a.breaks, breaks = _t === void 0 ? true : _t, _u = _a.typographer, typographer = _u === void 0 ? true : _u, _v = _a.linkify, linkify = _v === void 0 ? true : _v, _w = _a.xhtmlOut, xhtmlOut = _w === void 0 ? false : _w, _x = _a.outMath, outMath = _x === void 0 ? {} : _x, _y = _a.mathJax, mathJax = _y === void 0 ? {} : _y, _z = _a.htmlSanitize, htmlSanitize = _z === void 0 ? {} : _z, _0 = _a.smiles, smiles = _0 === void 0 ? {} : _0, _1 = _a.openLinkInNewWindow, openLinkInNewWindow = _1 === void 0 ? true : _1, _2 = _a.maxWidth, maxWidth = _2 === void 0 ? '' : _2, _3 = _a.enableFileLinks, enableFileLinks = _3 === void 0 ? false : _3, _4 = _a.validateLink, validateLink = _4 === void 0 ? null : _4, _5 = _a.toc, toc = _5 === void 0 ? {} : _5, _6 = _a.accessibility, accessibility = _6 === void 0 ? null : _6, _7 = _a.nonumbers, nonumbers = _7 === void 0 ? false : _7, _8 = _a.showPageBreaks, showPageBreaks = _8 === void 0 ? false : _8, _9 = _a.centerImages, centerImages = _9 === void 0 ? true : _9, _10 = _a.centerTables, centerTables = _10 === void 0 ? true : _10, _11 = _a.enableCodeBlockRuleForLatexCommands, enableCodeBlockRuleForLatexCommands = _11 === void 0 ? false : _11, _12 = _a.addPositionsToTokens, addPositionsToTokens = _12 === void 0 ? false : _12, _13 = _a.highlights, highlights = _13 === void 0 ? [] : _13, _14 = _a.parserErrors, parserErrors = _14 === void 0 ? ParserErrors.show : _14, _15 = _a.codeHighlight, codeHighlight = _15 === void 0 ? {} : _15, _16 = _a.footnotes, footnotes = _16 === void 0 ? {} : _16, _17 = _a.copyToClipboard, copyToClipboard = _17 === void 0 ? false : _17, _18 = _a.renderOptions, renderOptions = _18 === void 0 ? null : _18, _19 = _a.previewUuid, previewUuid = _19 === void 0 ? '' : _19;
323
376
  var disableRules = isDisableFancy ? _this.disableFancyArrayDef : options ? options.disableRules || [] : [];
324
377
  if (showToc) {
325
- var index = disableRules.indexOf('toc');
326
- if (disableRules.indexOf('toc') === -1) {
327
- disableRules.splice(index, 1);
378
+ var idx = disableRules.indexOf('toc');
379
+ if (idx !== -1) {
380
+ disableRules.splice(idx, 1);
328
381
  }
329
382
  }
330
383
  else {
331
- disableRules.push('toc');
384
+ if (!disableRules.includes('toc')) {
385
+ disableRules.push('toc');
386
+ }
332
387
  }
333
388
  var disableRuleTypes = renderOptions ? (0, mmdRulesToDisable_1.getDisableRuleTypes)(renderOptions) : [];
334
389
  var markdownItOptions = {