@diplodoc/client 3.4.2 → 3.4.4
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/CHANGELOG.md +14 -0
- package/build/client/app.css +1 -1
- package/build/client/app.css.map +1 -1
- package/build/client/app.rtl.css +1 -1
- package/build/client/react.js +1 -1
- package/build/client/react.js.map +1 -1
- package/build/client/vendor.css +96 -20
- package/build/client/vendor.css.map +1 -1
- package/build/client/vendor.js +1 -1
- package/build/client/vendor.js.map +1 -1
- package/build/client/vendor.rtl.css +96 -20
- package/build/server/react.js +2 -16
- package/build/server/react.js.map +1 -1
- package/build/server/vendor.js +237 -71
- package/build/server/vendor.js.map +1 -1
- package/package.json +2 -2
package/build/server/vendor.js
CHANGED
|
@@ -13776,15 +13776,11 @@ bem-cn/lib/index.js:
|
|
|
13776
13776
|
|
|
13777
13777
|
"use strict";
|
|
13778
13778
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13779
|
-
/* harmony export */ UQ: () => (/* binding */
|
|
13779
|
+
/* harmony export */ UQ: () => (/* binding */ b)
|
|
13780
13780
|
/* harmony export */ });
|
|
13781
13781
|
/* unused harmony exports usePageConstructor, usePageConstructorController */
|
|
13782
13782
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(96540);
|
|
13783
|
-
|
|
13784
|
-
/* harmony import */ var _gravity_ui_page_constructor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(47658);
|
|
13785
|
-
/* harmony import */ var _gravity_ui_page_constructor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(95168);
|
|
13786
|
-
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(74848);
|
|
13787
|
-
var x=Object.defineProperty;var C=(I,g)=>x(I,"name",{value:g,configurable:!0});var p=C((I,g,A)=>new Promise((t,c)=>{var b=C(l=>{try{i(A.next(l))}catch(e){c(e)}},"fulfilled"),G=C(l=>{try{i(A.throw(l))}catch(e){c(e)}},"rejected"),i=C(l=>l.done?t(l.value):Promise.resolve(l.value).then(b,G),"step");i((A=A.apply(I,g)).next())}),"__async"),R,Y,k,v,f,V,L;R=new WeakMap;Y=new WeakMap;k=new WeakMap;v=new WeakMap;f=new WeakMap;V=new WeakMap;L=new WeakMap;var W=C(()=>typeof window<"u"&&typeof window.document<"u","isBrowser"),o=Symbol.for("extension-load-queues"),J=Symbol.for("single-queue"),u=C(I=>{if(W()){if(!window[I])window[I]=[];else if(!Array.isArray(window[I]))throw new Error(`Expected window[${String(I)}] to be an array`);return window[I]}else throw new Error("Cannot initialize QueueStore in a non-browser environment.")},"getScriptStore"),Z=C(()=>{if(W())(typeof window[o]!="object"||window[o]===null)&&(window[o]={});else throw new Error("Cannot initialize QueueStore in a non-browser environment.")},"ensureQueuesSymbolInitialized"),N=C(I=>{var g;return Z(),((g=window[o])==null?void 0:g[I])||!1},"getQueueStore"),H=C(I=>(Z(),g=>{window[o][I]=g}),"createHandleQueueCreated"),s=C(({store:I,createController:g,queueKey:A=J,isQueueCreated:t=N(A),onQueueCreated:c=H(A)})=>{if(!I||t)return;c(!0);let b=g(),G=I.splice(0,I.length);I.push=function(...n){return n.forEach(h=>{G.push(h),l()}),G.length};let i=!1;function l(){i||e()}C(l,"unqueue");function e(){return p(this,null,function*(){i=!0;let n=G.shift();if(n)return yield n(b),e();i=!1})}C(e,"next"),l()},"createLoadQueue");function r(I,g){return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_gravity_ui_page_constructor__WEBPACK_IMPORTED_MODULE_3__/* .PageConstructorProvider */ .Z,{ssrConfig:{isServer:g===void 0?typeof window>"u"&&typeof global<"u":g},children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_gravity_ui_page_constructor__WEBPACK_IMPORTED_MODULE_4__/* .PageConstructor */ .i,{content:I})})}C(r,"createPageConstructorElement");var B={PageConstructor:"yfm-page-constructor"};var a=Symbol.for("page-constructor-store"),z=Symbol.for("page-constructor-queue"),d=class{static{C(this,"PageConstructorController")}renderContainer(g){try{let A=g.getAttribute("data-hydrated")==="true",t=g.getAttribute("data-rendered")==="true";if(A||t)return;let c=g.getAttribute("data-content-encoded");if(!c)return;let b=decodeURIComponent(c),G=JSON.parse(b);!A&&g.innerHTML.trim()!==""?((0,react_dom_client__WEBPACK_IMPORTED_MODULE_1__/* .hydrateRoot */ .c)(g,r(G,!1)),g.setAttribute("data-hydrated","true")):t||((0,react_dom_client__WEBPACK_IMPORTED_MODULE_1__/* .createRoot */ .H)(g).render(r(G,!1)),g.setAttribute("data-rendered","true"))}catch(A){console.error("Failed to render component:",A)}}getContainers(){return typeof document>"u"?[]:Array.from(document.querySelectorAll(`.${B.PageConstructor}`))}render(){this.getContainers().forEach(A=>this.renderContainer(A))}},X={render:C(()=>{u(a).push(g=>{g.render()})},"render")};if(typeof document<"u"){let I=u(a);s({store:I,createController:C(()=>{let g=new d;return document.readyState==="complete"||document.readyState==="interactive"?g.render():document.addEventListener("DOMContentLoaded",()=>{g.render()}),g},"createController"),queueKey:z})}function D(I){let[g,A]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);return (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{let t=u(I),c=C(b=>{A(b)},"callback");return t.push(c),()=>{let b=t.indexOf(c);b>-1&&t.splice(b,1)}},[I]),g}C(D,"useController");function ng(){return D(a)}C(ng,"usePageConstructorController");function ag(){return (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(()=>{X.render()},[])}C(ag,"usePageConstructor");function rg(){return (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{X.render()},[]),null}C(rg,"PageConstructorRuntime");
|
|
13783
|
+
var h=Object.defineProperty;var e=(t,n)=>h(t,"name",{value:n,configurable:!0});var c,d,_,p,w,A,C;c=new WeakMap;d=new WeakMap;_=new WeakMap;p=new WeakMap;w=new WeakMap;A=new WeakMap;C=new WeakMap;var S=e(()=>typeof window<"u"&&typeof window.document<"u","isBrowser"),v=Symbol.for("extension-load-queues"),R=Symbol.for("single-queue"),a=e(t=>{if(S()){if(!window[t])window[t]=[];else if(!Array.isArray(window[t]))throw new Error(`Expected window[${String(t)}] to be an array`);return window[t]}else throw new Error("Cannot initialize QueueStore in a non-browser environment.")},"getScriptStore");var o=Symbol.for("page-constructor-store"),k=Symbol.for("page-constructor-queue");function T(t){let[n,f]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);return (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{let i=a(t),s=e(r=>{f(r)},"callback");return i.push(s),()=>{let r=i.indexOf(s);r>-1&&i.splice(r,1)}},[t]),n}e(T,"useController");function u(){return T(o)}e(u,"usePageConstructorController");function U(){let t=u();return (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(()=>{t?.render()},[t])}e(U,"usePageConstructor");function b(){let t=u();return (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{t?.render()},[t]),null}e(b,"PageConstructorRuntime");
|
|
13788
13784
|
//# sourceMappingURL=index.js.map
|
|
13789
13785
|
|
|
13790
13786
|
|
|
@@ -14778,6 +14774,26 @@ function TabsRuntime(props = {}) {
|
|
|
14778
14774
|
mod
|
|
14779
14775
|
));
|
|
14780
14776
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14777
|
+
var __async = (__this, __arguments, generator) => {
|
|
14778
|
+
return new Promise((resolve, reject) => {
|
|
14779
|
+
var fulfilled = (value) => {
|
|
14780
|
+
try {
|
|
14781
|
+
step(generator.next(value));
|
|
14782
|
+
} catch (e) {
|
|
14783
|
+
reject(e);
|
|
14784
|
+
}
|
|
14785
|
+
};
|
|
14786
|
+
var rejected = (value) => {
|
|
14787
|
+
try {
|
|
14788
|
+
step(generator.throw(value));
|
|
14789
|
+
} catch (e) {
|
|
14790
|
+
reject(e);
|
|
14791
|
+
}
|
|
14792
|
+
};
|
|
14793
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
14794
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
14795
|
+
});
|
|
14796
|
+
};
|
|
14781
14797
|
|
|
14782
14798
|
// node_modules/get-root-node-polyfill/index.js
|
|
14783
14799
|
var require_get_root_node_polyfill = __commonJS({
|
|
@@ -15173,12 +15189,9 @@ function TabsRuntime(props = {}) {
|
|
|
15173
15189
|
const target = getEventTarget(event);
|
|
15174
15190
|
return !target || !target.matches;
|
|
15175
15191
|
};
|
|
15176
|
-
|
|
15177
|
-
// src/js/code.ts
|
|
15178
|
-
var BUTTON_SELECTOR = ".yfm-clipboard-button";
|
|
15179
|
-
function copyToClipboard(text) {
|
|
15192
|
+
var copyToClipboard = (text) => __async(void 0, null, function* () {
|
|
15180
15193
|
if (!text) {
|
|
15181
|
-
return
|
|
15194
|
+
return;
|
|
15182
15195
|
}
|
|
15183
15196
|
if (navigator.clipboard && typeof navigator.clipboard.writeText) {
|
|
15184
15197
|
return navigator.clipboard.writeText(text);
|
|
@@ -15190,8 +15203,10 @@ function TabsRuntime(props = {}) {
|
|
|
15190
15203
|
textarea.select();
|
|
15191
15204
|
document.execCommand("copy");
|
|
15192
15205
|
document.body.removeChild(textarea);
|
|
15193
|
-
|
|
15194
|
-
|
|
15206
|
+
});
|
|
15207
|
+
|
|
15208
|
+
// src/js/code.ts
|
|
15209
|
+
var BUTTON_SELECTOR = ".yfm-clipboard-button";
|
|
15195
15210
|
function notifySuccess(svgButton) {
|
|
15196
15211
|
if (!svgButton) {
|
|
15197
15212
|
return;
|
|
@@ -15217,12 +15232,32 @@ function TabsRuntime(props = {}) {
|
|
|
15217
15232
|
if (!code) {
|
|
15218
15233
|
return;
|
|
15219
15234
|
}
|
|
15220
|
-
|
|
15235
|
+
const textContent = Array.from(code.childNodes).filter((node) => {
|
|
15236
|
+
if (node instanceof HTMLElement && node.classList.contains("yfm-line-number")) {
|
|
15237
|
+
return false;
|
|
15238
|
+
}
|
|
15239
|
+
return true;
|
|
15240
|
+
}).map((node) => node.textContent).join("");
|
|
15241
|
+
copyToClipboard(textContent).then(() => {
|
|
15221
15242
|
notifySuccess(parent.querySelector(".yfm-clipboard-icon"));
|
|
15222
15243
|
});
|
|
15223
15244
|
});
|
|
15224
15245
|
}
|
|
15225
15246
|
|
|
15247
|
+
// src/js/anchor.ts
|
|
15248
|
+
var ANCHOR_BUTTON_SELECTOR = ".yfm-clipboard-anchor";
|
|
15249
|
+
if (typeof document !== "undefined") {
|
|
15250
|
+
document.addEventListener("click", (event) => {
|
|
15251
|
+
const target = getEventTarget(event);
|
|
15252
|
+
if (isCustom(event) || !target.matches(ANCHOR_BUTTON_SELECTOR)) {
|
|
15253
|
+
return;
|
|
15254
|
+
}
|
|
15255
|
+
const href = target.getAttribute("data-href") || "";
|
|
15256
|
+
const link = new URL(href, window.location.href).toString();
|
|
15257
|
+
copyToClipboard(link);
|
|
15258
|
+
});
|
|
15259
|
+
}
|
|
15260
|
+
|
|
15226
15261
|
// src/js/term/utils.ts
|
|
15227
15262
|
var Selector = {
|
|
15228
15263
|
TITLE: ".yfm .yfm-term_title",
|
|
@@ -15231,17 +15266,6 @@ function TabsRuntime(props = {}) {
|
|
|
15231
15266
|
var openClass = "open";
|
|
15232
15267
|
var openDefinitionClass = Selector.CONTENT.replace(/\./g, "") + " " + openClass;
|
|
15233
15268
|
var isListenerNeeded = true;
|
|
15234
|
-
function createDefinitionElement(termElement) {
|
|
15235
|
-
var _a;
|
|
15236
|
-
const termKey = termElement.getAttribute("term-key");
|
|
15237
|
-
const definitionTemplate = document.getElementById(
|
|
15238
|
-
`${termKey}_template`
|
|
15239
|
-
);
|
|
15240
|
-
const definitionElement = definitionTemplate == null ? void 0 : definitionTemplate.content.cloneNode(true).firstChild;
|
|
15241
|
-
(_a = definitionTemplate == null ? void 0 : definitionTemplate.parentElement) == null ? void 0 : _a.appendChild(definitionElement);
|
|
15242
|
-
definitionTemplate.remove();
|
|
15243
|
-
return definitionElement;
|
|
15244
|
-
}
|
|
15245
15269
|
function setDefinitionId(definitionElement, termElement) {
|
|
15246
15270
|
const termId = termElement.getAttribute("id") || Math.random().toString(36).substr(2, 8);
|
|
15247
15271
|
definitionElement == null ? void 0 : definitionElement.setAttribute("term-id", termId);
|
|
@@ -15324,10 +15348,7 @@ function TabsRuntime(props = {}) {
|
|
|
15324
15348
|
const openedDefinition = document.getElementsByClassName(openDefinitionClass)[0];
|
|
15325
15349
|
const termId = target.getAttribute("id");
|
|
15326
15350
|
const termKey = target.getAttribute("term-key");
|
|
15327
|
-
|
|
15328
|
-
if (termKey && !definitionElement) {
|
|
15329
|
-
definitionElement = createDefinitionElement(target);
|
|
15330
|
-
}
|
|
15351
|
+
const definitionElement = document.getElementById(termKey + "_element");
|
|
15331
15352
|
const isSameTerm = openedDefinition && termId === openedDefinition.getAttribute("term-id");
|
|
15332
15353
|
if (isSameTerm) {
|
|
15333
15354
|
closeDefinition(openedDefinition);
|
|
@@ -15560,6 +15581,18 @@ function TabsRuntime(props = {}) {
|
|
|
15560
15581
|
//# sourceMappingURL=yfm.js.map
|
|
15561
15582
|
|
|
15562
15583
|
|
|
15584
|
+
/***/ }),
|
|
15585
|
+
|
|
15586
|
+
/***/ 55323:
|
|
15587
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
15588
|
+
|
|
15589
|
+
"use strict";
|
|
15590
|
+
|
|
15591
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
15592
|
+
exports.DEFAULT_LANG = void 0;
|
|
15593
|
+
exports.DEFAULT_LANG = 'ru';
|
|
15594
|
+
//# sourceMappingURL=constants.js.map
|
|
15595
|
+
|
|
15563
15596
|
/***/ }),
|
|
15564
15597
|
|
|
15565
15598
|
/***/ 97584:
|
|
@@ -17101,6 +17134,29 @@ exports["default"] = exports.log;
|
|
|
17101
17134
|
|
|
17102
17135
|
"use strict";
|
|
17103
17136
|
|
|
17137
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17138
|
+
if (k2 === undefined) k2 = k;
|
|
17139
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17140
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17141
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17142
|
+
}
|
|
17143
|
+
Object.defineProperty(o, k2, desc);
|
|
17144
|
+
}) : (function(o, m, k, k2) {
|
|
17145
|
+
if (k2 === undefined) k2 = k;
|
|
17146
|
+
o[k2] = m[k];
|
|
17147
|
+
}));
|
|
17148
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17149
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17150
|
+
}) : function(o, v) {
|
|
17151
|
+
o["default"] = v;
|
|
17152
|
+
});
|
|
17153
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
17154
|
+
if (mod && mod.__esModule) return mod;
|
|
17155
|
+
var result = {};
|
|
17156
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17157
|
+
__setModuleDefault(result, mod);
|
|
17158
|
+
return result;
|
|
17159
|
+
};
|
|
17104
17160
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
17105
17161
|
var t = {};
|
|
17106
17162
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -17123,8 +17179,9 @@ const log_1 = __webpack_require__(69184);
|
|
|
17123
17179
|
const highlight_1 = __importDefault(__webpack_require__(44370));
|
|
17124
17180
|
const title_1 = __importDefault(__webpack_require__(50440));
|
|
17125
17181
|
const headings_1 = __importDefault(__webpack_require__(70235));
|
|
17126
|
-
const sanitize_1 =
|
|
17182
|
+
const sanitize_1 = __importStar(__webpack_require__(44891));
|
|
17127
17183
|
const ol_attr_conversion_1 = __webpack_require__(37985);
|
|
17184
|
+
const constants_1 = __webpack_require__(55323);
|
|
17128
17185
|
function initMarkdownIt(options) {
|
|
17129
17186
|
const { allowHTML = false, linkify = false, breaks = true, highlightLangs = {}, disableRules = [], } = options;
|
|
17130
17187
|
const highlight = (0, highlight_1.default)(highlightLangs);
|
|
@@ -17161,13 +17218,14 @@ function initMarkdownIt(options) {
|
|
|
17161
17218
|
return { parse, compile, env };
|
|
17162
17219
|
}
|
|
17163
17220
|
function getPluginOptions(options) {
|
|
17164
|
-
const { vars = {}, path, extractTitle, conditionsInCode = false, disableLiquid = false } = options, customOptions = __rest(options, ["vars", "path", "extractTitle", "conditionsInCode", "disableLiquid"]);
|
|
17221
|
+
const { vars = {}, path, extractTitle, conditionsInCode = false, disableLiquid = false, lang = constants_1.DEFAULT_LANG } = options, customOptions = __rest(options, ["vars", "path", "extractTitle", "conditionsInCode", "disableLiquid", "lang"]);
|
|
17165
17222
|
return Object.assign(Object.assign({}, customOptions), { conditionsInCode,
|
|
17166
17223
|
vars,
|
|
17167
17224
|
path,
|
|
17168
17225
|
extractTitle,
|
|
17169
17226
|
disableLiquid,
|
|
17170
|
-
log: log_1.log
|
|
17227
|
+
log: log_1.log,
|
|
17228
|
+
lang });
|
|
17171
17229
|
}
|
|
17172
17230
|
function initPlugins(md, options, pluginOptions) {
|
|
17173
17231
|
const { linkify = false, linkifyTlds, leftDelimiter = '{', rightDelimiter = '}', plugins = plugins_1.default, enableMarkdownAttrs, } = options;
|
|
@@ -17210,18 +17268,31 @@ function initParser(md, options, env, pluginOptions) {
|
|
|
17210
17268
|
};
|
|
17211
17269
|
}
|
|
17212
17270
|
function initCompiler(md, options, env) {
|
|
17213
|
-
const { needToSanitizeHtml = true, renderInline = false, sanitizeOptions } = options;
|
|
17271
|
+
const { needToSanitizeHtml = true, renderInline = false, sanitizeOptions, sanitize } = options;
|
|
17214
17272
|
return (tokens) => {
|
|
17273
|
+
var _a;
|
|
17215
17274
|
// Remove inline tokens if inline mode is activated
|
|
17216
17275
|
if (renderInline) {
|
|
17217
17276
|
tokens = tokens.filter((token) => token.type === 'inline');
|
|
17218
17277
|
}
|
|
17219
17278
|
// Generate HTML
|
|
17220
|
-
|
|
17221
|
-
|
|
17222
|
-
|
|
17223
|
-
|
|
17224
|
-
|
|
17279
|
+
let html = md.renderer.render(tokens, md.options, env);
|
|
17280
|
+
if (!needToSanitizeHtml) {
|
|
17281
|
+
return html;
|
|
17282
|
+
}
|
|
17283
|
+
// If a custom sanitizer was used, we need to ensure styles are sanitized
|
|
17284
|
+
// unless explicitly disabled via disableStyleSanitizer option
|
|
17285
|
+
if (sanitize && !((_a = sanitizeOptions === null || sanitizeOptions === void 0 ? void 0 : sanitizeOptions.disableStyleSanitizer) !== null && _a !== void 0 ? _a : false)) {
|
|
17286
|
+
const baseOptions = sanitizeOptions || sanitize_1.defaultOptions;
|
|
17287
|
+
const mergedOptions = Object.assign(Object.assign({}, baseOptions), { cssWhiteList: Object.assign(Object.assign(Object.assign({}, (sanitize_1.defaultOptions.cssWhiteList || {})), (baseOptions.cssWhiteList || {})), (env.additionalOptionsCssWhiteList || {})) });
|
|
17288
|
+
html = (0, sanitize_1.sanitizeStyles)(html, mergedOptions);
|
|
17289
|
+
}
|
|
17290
|
+
const sanitizedHtml = sanitize
|
|
17291
|
+
? sanitize(html, sanitizeOptions)
|
|
17292
|
+
: (0, sanitize_1.default)(html, sanitizeOptions, {
|
|
17293
|
+
cssWhiteList: env.additionalOptionsCssWhiteList,
|
|
17294
|
+
});
|
|
17295
|
+
return sanitizedHtml;
|
|
17225
17296
|
};
|
|
17226
17297
|
}
|
|
17227
17298
|
module.exports = initMarkdownIt;
|
|
@@ -17280,9 +17351,27 @@ module.exports = defaultPlugins;
|
|
|
17280
17351
|
"use strict";
|
|
17281
17352
|
|
|
17282
17353
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
17283
|
-
exports.CUSTOM_ID_EXCEPTION = exports.CUSTOM_ID_REGEXP = void 0;
|
|
17354
|
+
exports.ANCHOR_TITLES = exports.CUSTOM_ID_EXCEPTION = exports.CUSTOM_ID_REGEXP = void 0;
|
|
17284
17355
|
exports.CUSTOM_ID_REGEXP = /\[?{ ?#(\S+) ?}]?/g;
|
|
17285
17356
|
exports.CUSTOM_ID_EXCEPTION = '[{#T}]';
|
|
17357
|
+
exports.ANCHOR_TITLES = {
|
|
17358
|
+
ru: 'Скопировать ссылку',
|
|
17359
|
+
en: 'Copy link',
|
|
17360
|
+
ar: 'انسخ الرابط',
|
|
17361
|
+
cs: 'Zkopírovat odkaz',
|
|
17362
|
+
fr: 'Copier le lien',
|
|
17363
|
+
es: 'Copiar enlace',
|
|
17364
|
+
he: 'העתק קישור',
|
|
17365
|
+
bg: 'Копиране на връзката',
|
|
17366
|
+
et: 'Kopeeri viide',
|
|
17367
|
+
el: 'Αντιγράψτε τον σύνδεσμο',
|
|
17368
|
+
pt: 'Copiar o link',
|
|
17369
|
+
zh: '复制链接',
|
|
17370
|
+
'zh-tw': '複製連結',
|
|
17371
|
+
kk: 'Сілтемені көшіру',
|
|
17372
|
+
tr: 'Bağlantıyı kopyala',
|
|
17373
|
+
uz: 'Havolani nusxalash',
|
|
17374
|
+
};
|
|
17286
17375
|
//# sourceMappingURL=constants.js.map
|
|
17287
17376
|
|
|
17288
17377
|
/***/ }),
|
|
@@ -17301,7 +17390,19 @@ const utils_1 = __webpack_require__(49963);
|
|
|
17301
17390
|
const slugify_1 = __importDefault(__webpack_require__(12495));
|
|
17302
17391
|
const utils_2 = __webpack_require__(82811);
|
|
17303
17392
|
const constants_1 = __webpack_require__(54493);
|
|
17304
|
-
function
|
|
17393
|
+
function createAnchorButtonTokens(state, id, setId = false, href, title) {
|
|
17394
|
+
const open = new state.Token('anchor_open', 'button', 1);
|
|
17395
|
+
const close = new state.Token('anchor_close', 'button', -1);
|
|
17396
|
+
if (setId) {
|
|
17397
|
+
open.attrSet('id', id);
|
|
17398
|
+
}
|
|
17399
|
+
open.attrSet('class', 'yfm-clipboard-anchor');
|
|
17400
|
+
open.attrSet('data-href', href + '#' + id);
|
|
17401
|
+
open.attrSet('aria-label', title);
|
|
17402
|
+
open.attrSet('title', title);
|
|
17403
|
+
return [open, close];
|
|
17404
|
+
}
|
|
17405
|
+
function createAnchorLinkTokens(state, id, setId = false, href, title) {
|
|
17305
17406
|
const open = new state.Token('link_open', 'a', 1);
|
|
17306
17407
|
const close = new state.Token('link_close', 'a', -1);
|
|
17307
17408
|
if (setId) {
|
|
@@ -17346,7 +17447,7 @@ const removeCustomIds = (token) => {
|
|
|
17346
17447
|
});
|
|
17347
17448
|
};
|
|
17348
17449
|
const index = (md, options) => {
|
|
17349
|
-
const { extractTitle, path, log, supportGithubAnchors, getPublicPath, disableCommonAnchors } = options;
|
|
17450
|
+
const { extractTitle, path, log, supportGithubAnchors, getPublicPath, disableCommonAnchors, useCommonAnchorButtons, lang, } = options;
|
|
17350
17451
|
const plugin = (state) => {
|
|
17351
17452
|
/* Do not use the plugin if it is included in the file */
|
|
17352
17453
|
if (state.env.includes && state.env.includes.length) {
|
|
@@ -17357,6 +17458,9 @@ const index = (md, options) => {
|
|
|
17357
17458
|
const tokens = state.tokens;
|
|
17358
17459
|
let i = 0;
|
|
17359
17460
|
const slugger = new github_slugger_1.default();
|
|
17461
|
+
const createAnchorTokens = useCommonAnchorButtons
|
|
17462
|
+
? createAnchorButtonTokens
|
|
17463
|
+
: createAnchorLinkTokens;
|
|
17360
17464
|
while (i < tokens.length) {
|
|
17361
17465
|
const token = tokens[i];
|
|
17362
17466
|
const isHeading = token.type === 'heading_open';
|
|
@@ -17395,16 +17499,18 @@ const index = (md, options) => {
|
|
|
17395
17499
|
ids[id] = 1;
|
|
17396
17500
|
}
|
|
17397
17501
|
const allAnchorIds = customIds ? customIds : [id];
|
|
17398
|
-
const anchorTitle =
|
|
17502
|
+
const anchorTitle = useCommonAnchorButtons
|
|
17503
|
+
? constants_1.ANCHOR_TITLES[lang]
|
|
17504
|
+
: removeCustomId(title).replace(/`/g, '');
|
|
17399
17505
|
allAnchorIds.forEach((customId) => {
|
|
17400
17506
|
var _a, _b;
|
|
17401
17507
|
const setId = id !== customId;
|
|
17402
17508
|
if (!disableCommonAnchors) {
|
|
17403
|
-
const linkTokens =
|
|
17509
|
+
const linkTokens = createAnchorTokens(state, customId, setId, href, anchorTitle);
|
|
17404
17510
|
(_a = inlineToken.children) === null || _a === void 0 ? void 0 : _a.unshift(...linkTokens);
|
|
17405
17511
|
}
|
|
17406
17512
|
if (supportGithubAnchors) {
|
|
17407
|
-
const ghLinkTokens =
|
|
17513
|
+
const ghLinkTokens = createAnchorTokens(state, ghId, true, href, anchorTitle);
|
|
17408
17514
|
(_b = inlineToken.children) === null || _b === void 0 ? void 0 : _b.unshift(...ghLinkTokens);
|
|
17409
17515
|
}
|
|
17410
17516
|
});
|
|
@@ -17575,10 +17681,35 @@ function termReplace(str, env, escape) {
|
|
|
17575
17681
|
const termCode = str.replace(reg, (_match, p1, _p2, p3) => `<i class="yfm yfm-term_title" term-key=":${p3}" id="${(0, utils_1.generateID)()}">${p1}</i>`);
|
|
17576
17682
|
return termCode || str;
|
|
17577
17683
|
}
|
|
17684
|
+
function addLineNumbers(code) {
|
|
17685
|
+
const lines = code.split('\n');
|
|
17686
|
+
const lineCount = lines.length;
|
|
17687
|
+
const maxDigits = String(lineCount).length;
|
|
17688
|
+
// Remove trailing empty line if it exists
|
|
17689
|
+
const hasTrailingNewline = code.endsWith('\n');
|
|
17690
|
+
const linesToProcess = hasTrailingNewline ? lines.slice(0, -1) : lines;
|
|
17691
|
+
return (linesToProcess
|
|
17692
|
+
.map((line, index) => {
|
|
17693
|
+
const lineNumber = String(index + 1).padStart(maxDigits, ' ');
|
|
17694
|
+
return `<span class="yfm-line-number">${lineNumber}</span>${line}`;
|
|
17695
|
+
})
|
|
17696
|
+
.join('\n') + (hasTrailingNewline ? '\n' : ''));
|
|
17697
|
+
}
|
|
17578
17698
|
const code = (md) => {
|
|
17579
17699
|
const superCodeRenderer = md.renderer.rules.fence;
|
|
17580
17700
|
md.renderer.rules.fence = function (tokens, idx, options, env, self) {
|
|
17581
|
-
const
|
|
17701
|
+
const token = tokens[idx];
|
|
17702
|
+
const showLineNumbers = token.info.includes('showLineNumbers');
|
|
17703
|
+
let superCode = superCodeRenderer === null || superCodeRenderer === void 0 ? void 0 : superCodeRenderer(tokens, idx, options, env, self);
|
|
17704
|
+
if (superCode && showLineNumbers) {
|
|
17705
|
+
// Extract the code content from the pre/code tags
|
|
17706
|
+
const codeMatch = superCode.match(/<pre[^>]*><code[^>]*>([\s\S]*?)<\/code><\/pre>/);
|
|
17707
|
+
if (codeMatch) {
|
|
17708
|
+
const codeContent = codeMatch[1];
|
|
17709
|
+
const codeWithLineNumbers = addLineNumbers(codeContent);
|
|
17710
|
+
superCode = superCode.replace(codeContent, codeWithLineNumbers);
|
|
17711
|
+
}
|
|
17712
|
+
}
|
|
17582
17713
|
const superCodeWithTerms = superCode && (env === null || env === void 0 ? void 0 : env.terms) ? termReplace(superCode, env, md.utils.escapeRE) : superCode;
|
|
17583
17714
|
return wrapInClipboard(superCodeWithTerms, idx);
|
|
17584
17715
|
};
|
|
@@ -18201,21 +18332,22 @@ exports.TITLES = {
|
|
|
18201
18332
|
|
|
18202
18333
|
const chalk_1 = __webpack_require__(55248);
|
|
18203
18334
|
const utils_1 = __webpack_require__(29108);
|
|
18204
|
-
const constants_1 = __webpack_require__(
|
|
18335
|
+
const constants_1 = __webpack_require__(55323);
|
|
18336
|
+
const constants_2 = __webpack_require__(51070);
|
|
18205
18337
|
const ALERT_RE = /^{% note (alert|info|tip|warning)\s*(?:"(.*?)")? %}$/;
|
|
18206
18338
|
const WRONG_NOTES = /^{% note (.*)%}/;
|
|
18207
|
-
function getTitle(type, originLang) {
|
|
18208
|
-
let lang = originLang;
|
|
18209
|
-
if (!lang || !Object.keys(constants_1.TITLES).includes(lang)) {
|
|
18210
|
-
lang = 'ru';
|
|
18211
|
-
}
|
|
18212
|
-
return constants_1.TITLES[lang][type];
|
|
18213
|
-
}
|
|
18214
18339
|
const matchCloseToken = (tokens, i) => {
|
|
18215
18340
|
return (tokens[i].type === 'paragraph_open' &&
|
|
18216
18341
|
tokens[i + 1].type === 'inline' &&
|
|
18217
18342
|
tokens[i + 1].content.trim() === '{% endnote %}');
|
|
18218
18343
|
};
|
|
18344
|
+
function getTitle(type, originLang) {
|
|
18345
|
+
let lang = originLang;
|
|
18346
|
+
if (!lang || !Object.keys(constants_2.TITLES).includes(lang)) {
|
|
18347
|
+
lang = constants_1.DEFAULT_LANG;
|
|
18348
|
+
}
|
|
18349
|
+
return constants_2.TITLES[lang][type];
|
|
18350
|
+
}
|
|
18219
18351
|
function matchOpenToken(tokens, i) {
|
|
18220
18352
|
return (tokens[i].type === 'paragraph_open' &&
|
|
18221
18353
|
tokens[i + 1].type === 'inline' &&
|
|
@@ -18227,8 +18359,7 @@ function matchWrongNotes(tokens, i) {
|
|
|
18227
18359
|
tokens[i + 1].content.match(WRONG_NOTES));
|
|
18228
18360
|
}
|
|
18229
18361
|
const findCloseTokenIdx = (0, utils_1.nestedCloseTokenIdxFactory)('Note', matchOpenToken, matchCloseToken);
|
|
18230
|
-
|
|
18231
|
-
const index = (md, { lang, notesAutotitle, path: optPath, log }) => {
|
|
18362
|
+
const index = (md, { lang = constants_1.DEFAULT_LANG, notesAutotitle, path: optPath, log }) => {
|
|
18232
18363
|
notesAutotitle = typeof notesAutotitle === 'boolean' ? notesAutotitle : true;
|
|
18233
18364
|
const plugin = (state) => {
|
|
18234
18365
|
const { tokens, env } = state;
|
|
@@ -18258,20 +18389,19 @@ const index = (md, { lang, notesAutotitle, path: optPath, log }) => {
|
|
|
18258
18389
|
// Add extra paragraph
|
|
18259
18390
|
const titleOpen = new state.Token('yfm_note_title_open', 'p', 1);
|
|
18260
18391
|
titleOpen.attrSet('class', 'yfm-note-title');
|
|
18261
|
-
const
|
|
18392
|
+
const autotitle = notesAutotitle ? getTitle(type, lang) : '';
|
|
18393
|
+
const titleContent = match[2] === undefined ? autotitle : match[2];
|
|
18394
|
+
const titleInline = state.md.parseInline(titleContent, state.env)[0];
|
|
18395
|
+
titleInline.map = null;
|
|
18262
18396
|
const titleClose = new state.Token('yfm_note_title_close', 'p', -1);
|
|
18263
18397
|
titleOpen.block = true;
|
|
18264
18398
|
titleClose.block = true;
|
|
18265
|
-
const autotitle = notesAutotitle ? getTitle(type, lang) : '';
|
|
18266
|
-
titleInline.content = match[2] === undefined ? autotitle : match[2];
|
|
18267
|
-
titleInline.children = [];
|
|
18268
18399
|
const contentOpen = new state.Token('yfm_note_content_open', 'div', 1);
|
|
18269
18400
|
contentOpen.attrSet('class', 'yfm-note-content');
|
|
18270
18401
|
const contentClose = new state.Token('yfm_note_content_close', 'div', -1);
|
|
18271
18402
|
if (newOpenToken.map) {
|
|
18272
18403
|
contentOpen.map = [newOpenToken.map[0] + 2, newOpenToken.map[1] - 2];
|
|
18273
18404
|
}
|
|
18274
|
-
state.md.inline.parse(titleInline.content, state.md, state.env, titleInline.children);
|
|
18275
18405
|
const insideTokens = [newOpenToken];
|
|
18276
18406
|
if (titleInline.content) {
|
|
18277
18407
|
insideTokens.push(titleOpen, titleInline, titleClose);
|
|
@@ -19183,11 +19313,6 @@ function processTermDefinition(md, options, state, currentLine, startLine, endLi
|
|
|
19183
19313
|
if (typeof state.env.terms[':' + label] === 'undefined') {
|
|
19184
19314
|
state.env.terms[':' + label] = title;
|
|
19185
19315
|
}
|
|
19186
|
-
token = new state.Token('template_open', 'template', 1);
|
|
19187
|
-
token.map = [startLine, currentLine + 1];
|
|
19188
|
-
token.attrSet('id', ':' + label + '_template');
|
|
19189
|
-
token.attrSet('label', label);
|
|
19190
|
-
state.tokens.push(token);
|
|
19191
19316
|
token = new state.Token('dfn_open', 'dfn', 1);
|
|
19192
19317
|
token.attrSet('class', 'yfm yfm-term_dfn');
|
|
19193
19318
|
token.attrSet('id', ':' + label + '_element');
|
|
@@ -19210,8 +19335,6 @@ function processTermDefinition(md, options, state, currentLine, startLine, endLi
|
|
|
19210
19335
|
}
|
|
19211
19336
|
token = new state.Token('dfn_close', 'dfn', -1);
|
|
19212
19337
|
state.tokens.push(token);
|
|
19213
|
-
token = new state.Token('template_close', 'template', -1);
|
|
19214
|
-
state.tokens.push(token);
|
|
19215
19338
|
/** current line links to end of term definition */
|
|
19216
19339
|
state.line = currentLine + 1;
|
|
19217
19340
|
return true;
|
|
@@ -19471,10 +19594,18 @@ function yandexParser(url) {
|
|
|
19471
19594
|
return match ? match[1] : url;
|
|
19472
19595
|
}
|
|
19473
19596
|
exports.yandexParser = yandexParser;
|
|
19474
|
-
const vkRegex = /^https:\/\/vk\.com\/video_ext\.php\?(
|
|
19597
|
+
const vkRegex = /^https:\/\/vk\.com\/video_ext\.php\?(.*)/;
|
|
19475
19598
|
function vkParser(url) {
|
|
19476
19599
|
const match = url.match(vkRegex);
|
|
19477
|
-
|
|
19600
|
+
if (match) {
|
|
19601
|
+
const searchParams = new URLSearchParams(match[1]);
|
|
19602
|
+
const encodedUrl = [];
|
|
19603
|
+
searchParams.forEach((value, key) => {
|
|
19604
|
+
encodedUrl.push(`${key}=${encodeURIComponent(value)}`);
|
|
19605
|
+
});
|
|
19606
|
+
return encodedUrl.join('&');
|
|
19607
|
+
}
|
|
19608
|
+
return url;
|
|
19478
19609
|
}
|
|
19479
19610
|
exports.vkParser = vkParser;
|
|
19480
19611
|
const rutubeRegex = /^https:\/\/rutube\.ru\/video\/([a-zA-Z0-9]+)\/?/;
|
|
@@ -19718,7 +19849,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19718
19849
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19719
19850
|
};
|
|
19720
19851
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
19721
|
-
exports.sanitize = exports.defaultOptions = exports.defaultParseOptions = void 0;
|
|
19852
|
+
exports.sanitize = exports.sanitizeStyles = exports.defaultOptions = exports.defaultParseOptions = void 0;
|
|
19722
19853
|
const sanitize_html_1 = __importDefault(__webpack_require__(74728));
|
|
19723
19854
|
// @ts-ignore
|
|
19724
19855
|
const cssfilter_1 = __importDefault(__webpack_require__(56018));
|
|
@@ -19887,6 +20018,7 @@ const svgTags = [
|
|
|
19887
20018
|
'view',
|
|
19888
20019
|
'vkern',
|
|
19889
20020
|
'animate',
|
|
20021
|
+
'use',
|
|
19890
20022
|
];
|
|
19891
20023
|
const htmlAttrs = [
|
|
19892
20024
|
'accept',
|
|
@@ -20201,10 +20333,43 @@ const defaultCssWhitelist = Object.assign(Object.assign({}, cssfilter_1.default.
|
|
|
20201
20333
|
const yfmHtmlAttrs = ['note-type', 'term-key'];
|
|
20202
20334
|
const allowedTags = Array.from(new Set([...htmlTags, ...svgTags, ...sanitize_html_1.default.defaults.allowedTags]));
|
|
20203
20335
|
const allowedAttributes = Array.from(new Set([...htmlAttrs, ...svgAttrs, ...yfmHtmlAttrs]));
|
|
20336
|
+
// For hrefs within "use" only allow local links to ids that start with "#"
|
|
20337
|
+
const useTagTransformer = (tagName, attribs) => {
|
|
20338
|
+
const cleanHref = (href) => {
|
|
20339
|
+
if (href.startsWith('#')) {
|
|
20340
|
+
return href;
|
|
20341
|
+
}
|
|
20342
|
+
else {
|
|
20343
|
+
return null;
|
|
20344
|
+
}
|
|
20345
|
+
};
|
|
20346
|
+
const cleanAttrs = (attrs) => {
|
|
20347
|
+
const HREF_ATTRIBUTES = ['xlink:href', 'href'];
|
|
20348
|
+
return Object.fromEntries(Object.entries(attrs)
|
|
20349
|
+
.map(([key, value]) => {
|
|
20350
|
+
if (HREF_ATTRIBUTES.includes(key)) {
|
|
20351
|
+
return [key, cleanHref(value)];
|
|
20352
|
+
}
|
|
20353
|
+
return [key, value];
|
|
20354
|
+
})
|
|
20355
|
+
.filter(([_, value]) => value !== null));
|
|
20356
|
+
};
|
|
20357
|
+
return {
|
|
20358
|
+
tagName,
|
|
20359
|
+
attribs: cleanAttrs(attribs),
|
|
20360
|
+
};
|
|
20361
|
+
};
|
|
20204
20362
|
exports.defaultParseOptions = {
|
|
20205
20363
|
lowerCaseAttributeNames: false,
|
|
20206
20364
|
};
|
|
20207
|
-
exports.defaultOptions = Object.assign(Object.assign({}, sanitize_html_1.default.defaults), { allowedTags, allowedAttributes: Object.assign(Object.assign({}, sanitize_html_1.default.defaults.allowedAttributes), { '*': allowedAttributes }),
|
|
20365
|
+
exports.defaultOptions = Object.assign(Object.assign({}, sanitize_html_1.default.defaults), { allowedTags, allowedAttributes: Object.assign(Object.assign({}, sanitize_html_1.default.defaults.allowedAttributes), { '*': allowedAttributes }), allowedSchemesAppliedToAttributes: [
|
|
20366
|
+
...sanitize_html_1.default.defaults.allowedSchemesAppliedToAttributes,
|
|
20367
|
+
'xlink:href',
|
|
20368
|
+
'from',
|
|
20369
|
+
'to',
|
|
20370
|
+
], allowVulnerableTags: true, parser: exports.defaultParseOptions, cssWhiteList: defaultCssWhitelist, transformTags: {
|
|
20371
|
+
use: useTagTransformer,
|
|
20372
|
+
} });
|
|
20208
20373
|
function sanitizeStyleTags(dom, cssWhiteList) {
|
|
20209
20374
|
const styleTags = dom('style');
|
|
20210
20375
|
styleTags.each((_index, element) => {
|
|
@@ -20264,6 +20429,7 @@ function sanitizeStyles(html, options) {
|
|
|
20264
20429
|
const content = $('body').html() || '';
|
|
20265
20430
|
return styles + content;
|
|
20266
20431
|
}
|
|
20432
|
+
exports.sanitizeStyles = sanitizeStyles;
|
|
20267
20433
|
function sanitize(html, options, additionalOptions) {
|
|
20268
20434
|
var _a;
|
|
20269
20435
|
const sanitizeOptions = options || exports.defaultOptions;
|