@readme/markdown 9.12.0 → 9.13.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/main.js +11 -3
- package/dist/main.node.js +11 -3
- package/dist/main.node.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -58684,7 +58684,8 @@ const coerceJsxToMd = ({ components = {}, html = false } = {}) => (node, index,
|
|
|
58684
58684
|
}
|
|
58685
58685
|
else if (node.name === 'Callout') {
|
|
58686
58686
|
const attrs = getAttrs(node);
|
|
58687
|
-
const {
|
|
58687
|
+
const { empty } = attrs;
|
|
58688
|
+
const icon = attrs.icon || defaultIcons[attrs.theme];
|
|
58688
58689
|
const theme = attrs.theme || themes[icon] || 'default';
|
|
58689
58690
|
const mdNode = {
|
|
58690
58691
|
children: node.children,
|
|
@@ -58766,17 +58767,24 @@ const readmeToMdx = () => tree => {
|
|
|
58766
58767
|
parent.children.splice(i, 1, newNode);
|
|
58767
58768
|
});
|
|
58768
58769
|
visit(tree, 'rdme-callout', (node, index, parent) => {
|
|
58769
|
-
const isEmoji = emoji_regex().test(node.data.hProperties.icon);
|
|
58770
58770
|
const isEmpty = node.data.hProperties?.empty;
|
|
58771
58771
|
const isH3 = node.children[0].type === 'heading' && node.children[0].depth === 3;
|
|
58772
|
+
let { icon, theme } = node.data.hProperties;
|
|
58773
|
+
if (!icon)
|
|
58774
|
+
icon = defaultIcons[theme];
|
|
58775
|
+
if (!theme)
|
|
58776
|
+
theme = themes[icon] || 'default';
|
|
58777
|
+
const isEmoji = emoji_regex().test(icon);
|
|
58772
58778
|
// return the usual markdown if there is an emoji and the icon theme matches our default theme
|
|
58773
|
-
if ((isEmpty || isH3) && isEmoji && themes[
|
|
58779
|
+
if ((isEmpty || isH3) && isEmoji && themes[icon] === theme) {
|
|
58774
58780
|
if (isH3) {
|
|
58775
58781
|
node.children[0] = {
|
|
58776
58782
|
type: 'paragraph',
|
|
58777
58783
|
children: 'children' in node.children[0] ? node.children[0].children : [],
|
|
58778
58784
|
};
|
|
58779
58785
|
}
|
|
58786
|
+
node.data.hProperties.icon = icon;
|
|
58787
|
+
node.data.hProperties.theme = theme;
|
|
58780
58788
|
return;
|
|
58781
58789
|
}
|
|
58782
58790
|
parent.children.splice(index, 1, {
|
package/dist/main.node.js
CHANGED
|
@@ -75594,7 +75594,8 @@ const coerceJsxToMd = ({ components = {}, html = false } = {}) => (node, index,
|
|
|
75594
75594
|
}
|
|
75595
75595
|
else if (node.name === 'Callout') {
|
|
75596
75596
|
const attrs = getAttrs(node);
|
|
75597
|
-
const {
|
|
75597
|
+
const { empty } = attrs;
|
|
75598
|
+
const icon = attrs.icon || defaultIcons[attrs.theme];
|
|
75598
75599
|
const theme = attrs.theme || themes[icon] || 'default';
|
|
75599
75600
|
const mdNode = {
|
|
75600
75601
|
children: node.children,
|
|
@@ -75676,17 +75677,24 @@ const readmeToMdx = () => tree => {
|
|
|
75676
75677
|
parent.children.splice(i, 1, newNode);
|
|
75677
75678
|
});
|
|
75678
75679
|
visit(tree, 'rdme-callout', (node, index, parent) => {
|
|
75679
|
-
const isEmoji = emoji_regex().test(node.data.hProperties.icon);
|
|
75680
75680
|
const isEmpty = node.data.hProperties?.empty;
|
|
75681
75681
|
const isH3 = node.children[0].type === 'heading' && node.children[0].depth === 3;
|
|
75682
|
+
let { icon, theme } = node.data.hProperties;
|
|
75683
|
+
if (!icon)
|
|
75684
|
+
icon = defaultIcons[theme];
|
|
75685
|
+
if (!theme)
|
|
75686
|
+
theme = themes[icon] || 'default';
|
|
75687
|
+
const isEmoji = emoji_regex().test(icon);
|
|
75682
75688
|
// return the usual markdown if there is an emoji and the icon theme matches our default theme
|
|
75683
|
-
if ((isEmpty || isH3) && isEmoji && themes[
|
|
75689
|
+
if ((isEmpty || isH3) && isEmoji && themes[icon] === theme) {
|
|
75684
75690
|
if (isH3) {
|
|
75685
75691
|
node.children[0] = {
|
|
75686
75692
|
type: 'paragraph',
|
|
75687
75693
|
children: 'children' in node.children[0] ? node.children[0].children : [],
|
|
75688
75694
|
};
|
|
75689
75695
|
}
|
|
75696
|
+
node.data.hProperties.icon = icon;
|
|
75697
|
+
node.data.hProperties.theme = theme;
|
|
75690
75698
|
return;
|
|
75691
75699
|
}
|
|
75692
75700
|
parent.children.splice(index, 1, {
|