@readme/markdown 6.75.0-beta.52 → 6.75.0-beta.54
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/components/Embed/index.tsx +27 -9
- package/components/Image/index.tsx +34 -32
- package/dist/components/Embed/index.d.ts +4 -2
- package/dist/enums.d.ts +2 -2
- package/dist/index.d.ts +2 -3
- package/dist/lib/hast.d.ts +1 -0
- package/dist/lib/index.d.ts +2 -2
- package/dist/main.js +53267 -53122
- package/dist/main.node.js +54121 -53976
- package/dist/processor/compile/embed.d.ts +2 -2
- package/dist/processor/compile/image.d.ts +2 -2
- package/dist/processor/transform/embeds.d.ts +2 -1
- package/dist/processor/transform/images.d.ts +3 -0
- package/dist/processor/utils.d.ts +7 -0
- package/package.json +2 -1
|
@@ -13,24 +13,42 @@ interface EmbedProps {
|
|
|
13
13
|
lazy?: boolean;
|
|
14
14
|
url: string;
|
|
15
15
|
title: string;
|
|
16
|
-
|
|
16
|
+
providerName?: string;
|
|
17
|
+
providerUrl?: string;
|
|
17
18
|
html?: string;
|
|
18
19
|
iframe?: boolean;
|
|
19
20
|
image?: string;
|
|
20
21
|
favicon?: string;
|
|
22
|
+
typeOfEmbed?: string;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
const Embed = ({
|
|
25
|
+
const Embed = ({
|
|
26
|
+
lazy = true,
|
|
27
|
+
url,
|
|
28
|
+
html,
|
|
29
|
+
providerName,
|
|
30
|
+
providerUrl,
|
|
31
|
+
title,
|
|
32
|
+
iframe,
|
|
33
|
+
image,
|
|
34
|
+
favicon,
|
|
35
|
+
...attrs
|
|
36
|
+
}: EmbedProps) => {
|
|
37
|
+
if (typeof iframe !== 'boolean') iframe = iframe === 'true';
|
|
38
|
+
if (html === 'false') html = undefined;
|
|
39
|
+
|
|
24
40
|
if (iframe) {
|
|
25
41
|
return <iframe {...attrs} src={url} style={{ border: 'none', display: 'flex', margin: 'auto' }} />;
|
|
26
42
|
}
|
|
27
43
|
|
|
28
|
-
if (!
|
|
29
|
-
|
|
44
|
+
if (!providerUrl && url)
|
|
45
|
+
providerUrl = new URL(url).hostname
|
|
30
46
|
.split(/(?:www)?\./)
|
|
31
47
|
.filter(i => i)
|
|
32
48
|
.join('.');
|
|
33
49
|
|
|
50
|
+
if (!providerName) providerName = providerUrl;
|
|
51
|
+
|
|
34
52
|
const classes = ['embed', image ? 'embed_hasImg' : ''];
|
|
35
53
|
|
|
36
54
|
return (
|
|
@@ -40,13 +58,13 @@ const Embed = ({ lazy = true, url, provider, title, html, iframe, image, favicon
|
|
|
40
58
|
) : (
|
|
41
59
|
<a className="embed-link" href={url} rel="noopener noreferrer" target="_blank">
|
|
42
60
|
{!image || <img alt={title} className="embed-img" loading={lazy ? 'lazy' : undefined} src={image} />}
|
|
43
|
-
{title ? (
|
|
61
|
+
{title && title !== '@embed' ? (
|
|
44
62
|
<div className="embed-body">
|
|
45
|
-
{!favicon || <Favicon alt={
|
|
46
|
-
{
|
|
63
|
+
{!favicon || <Favicon alt={providerName} src={favicon} />}
|
|
64
|
+
{providerUrl && (
|
|
47
65
|
<small className="embed-provider">
|
|
48
|
-
{
|
|
49
|
-
|
|
66
|
+
{providerUrl.search(/^@{1}/) < 0 ? (
|
|
67
|
+
providerName
|
|
50
68
|
) : (
|
|
51
69
|
<code style={{ fontFamily: 'var(--md-code-font, monospace)' }}>{url}</code>
|
|
52
70
|
)}
|
|
@@ -57,16 +57,16 @@ const Image = (Props: ImageProps) => {
|
|
|
57
57
|
|
|
58
58
|
if (caption) {
|
|
59
59
|
return (
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
>
|
|
69
|
-
<
|
|
60
|
+
<span
|
|
61
|
+
aria-label={alt}
|
|
62
|
+
className={`img lightbox ${lightbox ? 'open' : 'closed'}`}
|
|
63
|
+
onClick={toggle}
|
|
64
|
+
onKeyDown={handleKeyDown}
|
|
65
|
+
role={'button'}
|
|
66
|
+
tabIndex={0}
|
|
67
|
+
>
|
|
68
|
+
<span className="lightbox-inner">
|
|
69
|
+
<figure>
|
|
70
70
|
<img
|
|
71
71
|
src={src}
|
|
72
72
|
width={width}
|
|
@@ -76,34 +76,36 @@ const Image = (Props: ImageProps) => {
|
|
|
76
76
|
alt={alt}
|
|
77
77
|
loading={lazy ? 'lazy' : 'eager'}
|
|
78
78
|
/>
|
|
79
|
-
|
|
79
|
+
<figcaption>{caption}</figcaption>
|
|
80
|
+
</figure>
|
|
80
81
|
</span>
|
|
81
|
-
|
|
82
|
-
</figure>
|
|
82
|
+
</span>
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
return (
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
87
|
+
<p>
|
|
88
|
+
<span
|
|
89
|
+
aria-label={alt}
|
|
90
|
+
className={`img lightbox ${lightbox ? 'open' : 'closed'}`}
|
|
91
|
+
onClick={toggle}
|
|
92
|
+
onKeyDown={handleKeyDown}
|
|
93
|
+
role={'button'}
|
|
94
|
+
tabIndex={0}
|
|
95
|
+
>
|
|
96
|
+
<span className="lightbox-inner">
|
|
97
|
+
<img
|
|
98
|
+
src={src}
|
|
99
|
+
width={width}
|
|
100
|
+
height={height}
|
|
101
|
+
title={title}
|
|
102
|
+
className={`img img-align-${align} ${border ? 'border' : ''}`}
|
|
103
|
+
alt={alt}
|
|
104
|
+
loading={lazy ? 'lazy' : 'eager'}
|
|
105
|
+
/>
|
|
106
|
+
</span>
|
|
105
107
|
</span>
|
|
106
|
-
</
|
|
108
|
+
</p>
|
|
107
109
|
);
|
|
108
110
|
};
|
|
109
111
|
|
|
@@ -3,11 +3,13 @@ interface EmbedProps {
|
|
|
3
3
|
lazy?: boolean;
|
|
4
4
|
url: string;
|
|
5
5
|
title: string;
|
|
6
|
-
|
|
6
|
+
providerName?: string;
|
|
7
|
+
providerUrl?: string;
|
|
7
8
|
html?: string;
|
|
8
9
|
iframe?: boolean;
|
|
9
10
|
image?: string;
|
|
10
11
|
favicon?: string;
|
|
12
|
+
typeOfEmbed?: string;
|
|
11
13
|
}
|
|
12
|
-
declare const Embed: ({ lazy, url,
|
|
14
|
+
declare const Embed: ({ lazy, url, html, providerName, providerUrl, title, iframe, image, favicon, ...attrs }: EmbedProps) => React.JSX.Element;
|
|
13
15
|
export default Embed;
|
package/dist/enums.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare enum NodeTypes {
|
|
2
2
|
callout = "rdme-callout",
|
|
3
3
|
codeTabs = "code-tabs",
|
|
4
|
-
|
|
4
|
+
embedBlock = "embed-block",
|
|
5
5
|
emoji = "gemoji",
|
|
6
6
|
glossary = "readme-glossary-item",
|
|
7
7
|
htmlBlock = "html-block",
|
|
8
8
|
i = "i",
|
|
9
|
-
|
|
9
|
+
imageBlock = "image-block",
|
|
10
10
|
reusableContent = "reusable-content",
|
|
11
11
|
tutorialTile = "tutorial-tile",
|
|
12
12
|
variable = "readme-variable"
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as Components from './components';
|
|
2
|
-
import { compile, hast, run, mdast, mdx, plain } from './lib';
|
|
3
2
|
import './styles/main.scss';
|
|
4
3
|
declare const utils: {
|
|
5
4
|
readonly options: any;
|
|
6
5
|
getHref: any;
|
|
7
6
|
calloutIcons: {};
|
|
8
7
|
};
|
|
9
|
-
export declare const reactProcessor: (opts?: {}) => import("unified").Processor<import("mdast").Root, import("estree").Program, import("estree").Program, import("estree").Program, string>;
|
|
10
8
|
export declare const html: (text: string, opts?: {}) => void;
|
|
11
9
|
export declare const esast: (text: string, opts?: {}) => void;
|
|
12
|
-
export { compile, hast, run, mdast, mdx, plain,
|
|
10
|
+
export { compile, hast, hastFromHtml, run, mdast, mdx, plain, remarkPlugins } from './lib';
|
|
11
|
+
export { Components, utils };
|
package/dist/lib/hast.d.ts
CHANGED
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import astProcessor, { MdastOpts, remarkPlugins } from './ast-processor';
|
|
2
2
|
import compile from './compile';
|
|
3
|
-
import hast from './hast';
|
|
3
|
+
import hast, { hastFromHtml } from './hast';
|
|
4
4
|
import mdast from './mdast';
|
|
5
5
|
import mdx from './mdx';
|
|
6
6
|
import plain from './plain';
|
|
7
7
|
import run from './run';
|
|
8
8
|
export type { MdastOpts };
|
|
9
|
-
export { astProcessor, compile, hast, mdast, mdx, plain, run, remarkPlugins };
|
|
9
|
+
export { astProcessor, compile, hast, hastFromHtml, mdast, mdx, plain, run, remarkPlugins };
|