mark-deco 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.cjs +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.mjs +2 -2
- package/dist/card-oembed-fallback.cjs +2 -2
- package/dist/card-oembed-fallback.d.ts +2 -2
- package/dist/card-oembed-fallback.mjs +2 -2
- package/dist/html-generator-BmIuyVQU.js +2 -2
- package/dist/html-generator-CHbU5jbh.cjs +2 -2
- package/dist/html-generator-DTRmTXLk.cjs +2 -2
- package/dist/html-generator-RU0HacgN.js +2 -2
- package/dist/index.cjs +20 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.mjs +20 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal.cjs +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.mjs +2 -2
- package/dist/misc.cjs +2 -2
- package/dist/misc.d.ts +2 -2
- package/dist/misc.mjs +2 -2
- package/dist/node.cjs +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.mjs +2 -2
- package/dist/utils-DBRV1kXj.cjs +2 -2
- package/dist/utils-DLDazcJ8.js +2 -2
- package/package.json +7 -7
package/dist/browser.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: mark-deco
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.3.0
|
|
4
4
|
* description: Flexible Markdown to HTML conversion library
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/mark-deco
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 6c448464efddc8483fa3496393a67728e9fa4765
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
"use strict";
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: mark-deco
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.3.0
|
|
4
4
|
* description: Flexible Markdown to HTML conversion library
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/mark-deco
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 6c448464efddc8483fa3496393a67728e9fa4765
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/browser.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: mark-deco
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.3.0
|
|
4
4
|
* description: Flexible Markdown to HTML conversion library
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/mark-deco
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 6c448464efddc8483fa3496393a67728e9fa4765
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { createMutex } from "async-primitives";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: mark-deco
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.3.0
|
|
4
4
|
* description: Flexible Markdown to HTML conversion library
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/mark-deco
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 6c448464efddc8483fa3496393a67728e9fa4765
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
"use strict";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: mark-deco
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.3.0
|
|
4
4
|
* description: Flexible Markdown to HTML conversion library
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/mark-deco
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 6c448464efddc8483fa3496393a67728e9fa4765
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: mark-deco
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.3.0
|
|
4
4
|
* description: Flexible Markdown to HTML conversion library
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/mark-deco
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 6c448464efddc8483fa3496393a67728e9fa4765
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { f as fetchOEmbedData, b as generateHtml, C as CORSError } from "./html-generator-RU0HacgN.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: mark-deco
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.3.0
|
|
4
4
|
* description: Flexible Markdown to HTML conversion library
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/mark-deco
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 6c448464efddc8483fa3496393a67728e9fa4765
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import * as cheerio from "cheerio";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: mark-deco
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.3.0
|
|
4
4
|
* description: Flexible Markdown to HTML conversion library
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/mark-deco
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 6c448464efddc8483fa3496393a67728e9fa4765
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
"use strict";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: mark-deco
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.3.0
|
|
4
4
|
* description: Flexible Markdown to HTML conversion library
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/mark-deco
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 6c448464efddc8483fa3496393a67728e9fa4765
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
"use strict";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: mark-deco
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.3.0
|
|
4
4
|
* description: Flexible Markdown to HTML conversion library
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/mark-deco
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 6c448464efddc8483fa3496393a67728e9fa4765
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { f as fetchText, a as isCORSError, c as createTimeoutSignal, b as combineAbortSignals, d as fetchJson, i as isBrowser } from "./utils-DLDazcJ8.js";
|
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: mark-deco
|
|
3
|
-
* version: 1.
|
|
3
|
+
* version: 1.3.0
|
|
4
4
|
* description: Flexible Markdown to HTML conversion library
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/mark-deco
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 6c448464efddc8483fa3496393a67728e9fa4765
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
"use strict";
|
|
@@ -676,6 +676,12 @@ const setNodeClassList = (node, classList) => {
|
|
|
676
676
|
delete node.properties.class;
|
|
677
677
|
}
|
|
678
678
|
};
|
|
679
|
+
const hasLoadingProperty = (node) => {
|
|
680
|
+
if (!node.properties) {
|
|
681
|
+
return false;
|
|
682
|
+
}
|
|
683
|
+
return Object.prototype.hasOwnProperty.call(node.properties, "loading");
|
|
684
|
+
};
|
|
679
685
|
const collectImageNodes = (node) => {
|
|
680
686
|
var _a;
|
|
681
687
|
const images = [];
|
|
@@ -699,8 +705,9 @@ const rehypeResponsiveImages = (options = {}) => {
|
|
|
699
705
|
const defaultOuterClassList = normalizeClassList(
|
|
700
706
|
options.defaultOuterClassName
|
|
701
707
|
);
|
|
708
|
+
const applyLazyLoadingToImg = options.applyLazyLoadingToImg === true;
|
|
702
709
|
return (tree) => {
|
|
703
|
-
unistUtilVisit.visit(tree, "element", (node) => {
|
|
710
|
+
unistUtilVisit.visit(tree, "element", (node, _index, parent) => {
|
|
704
711
|
if (node.tagName === "p") {
|
|
705
712
|
const imageNodes = collectImageNodes(node);
|
|
706
713
|
if (imageNodes.length > 0) {
|
|
@@ -728,6 +735,11 @@ const rehypeResponsiveImages = (options = {}) => {
|
|
|
728
735
|
if (!node.properties) {
|
|
729
736
|
node.properties = {};
|
|
730
737
|
}
|
|
738
|
+
const parentElement = parent && parent.type === "element" ? parent : void 0;
|
|
739
|
+
const hasParentLoading = (parentElement == null ? void 0 : parentElement.tagName) === "p" && hasLoadingProperty(parentElement);
|
|
740
|
+
if (applyLazyLoadingToImg && !hasLoadingProperty(node) && !hasParentLoading) {
|
|
741
|
+
node.properties.loading = "lazy";
|
|
742
|
+
}
|
|
731
743
|
const existingStyle = node.properties.style || "";
|
|
732
744
|
const combinedStyles = existingStyle ? `${existingStyle}; ${responsiveStyles}` : responsiveStyles;
|
|
733
745
|
node.properties.style = combinedStyles;
|
|
@@ -1508,6 +1520,7 @@ const createMarkdownProcessor = (options) => {
|
|
|
1508
1520
|
useHierarchicalHeadingId = true,
|
|
1509
1521
|
headingBaseLevel,
|
|
1510
1522
|
defaultImageOuterClassName,
|
|
1523
|
+
applyLazyLoadingToImg = false,
|
|
1511
1524
|
codeHighlight,
|
|
1512
1525
|
resolveUrl,
|
|
1513
1526
|
linkTarget,
|
|
@@ -1542,7 +1555,10 @@ const createMarkdownProcessor = (options) => {
|
|
|
1542
1555
|
if (hasCodeHighlight) {
|
|
1543
1556
|
processor0 = processor0.use(remarkProtectCodeMeta);
|
|
1544
1557
|
}
|
|
1545
|
-
const responsiveImageOptions = defaultImageOuterClassName === void 0 ? void 0 : {
|
|
1558
|
+
const responsiveImageOptions = defaultImageOuterClassName === void 0 && !applyLazyLoadingToImg ? void 0 : {
|
|
1559
|
+
defaultOuterClassName: defaultImageOuterClassName,
|
|
1560
|
+
applyLazyLoadingToImg
|
|
1561
|
+
};
|
|
1546
1562
|
const normalizedLinkTarget = typeof linkTarget === "string" && linkTarget.trim().length > 0 ? linkTarget : void 0;
|
|
1547
1563
|
const normalizedLinkRel = typeof linkRel === "string" && linkRel.trim().length > 0 ? linkRel : void 0;
|
|
1548
1564
|
let processor = processor0.use(remarkGfmPlugin, gfmOptions).use(remarkAttr);
|