@readme/markdown 6.75.0-beta.32 → 6.75.0-beta.34
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/Callout/index.tsx +1 -1
- package/components/Code/index.tsx +7 -8
- package/components/Embed/index.tsx +68 -0
- package/components/Image/index.tsx +26 -12
- package/dist/components/Callout/index.d.ts +1 -1
- package/dist/components/Code/index.d.ts +3 -2
- package/dist/components/Embed/index.d.ts +13 -0
- package/dist/components/Image/index.d.ts +5 -4
- package/dist/enums.d.ts +3 -2
- package/dist/main.js +64855 -66021
- package/dist/main.node.js +78715 -79596
- package/dist/processor/compile/embed.d.ts +3 -0
- package/dist/processor/transform/code-tabs.d.ts +2 -2
- package/dist/processor/transform/embeds.d.ts +2 -0
- package/package.json +1 -1
- package/components/Embed/index.jsx +0 -89
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default
|
|
1
|
+
declare const codeTabsTransformer: () => (tree: any) => any;
|
|
2
|
+
export default codeTabsTransformer;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@readme/markdown",
|
|
3
3
|
"description": "ReadMe's React-based Markdown parser",
|
|
4
4
|
"author": "Rafe Goldberg <rafe@readme.io>",
|
|
5
|
-
"version": "6.75.0-beta.
|
|
5
|
+
"version": "6.75.0-beta.34",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/jsx-props-no-spreading, jsx-a11y/iframe-has-title */
|
|
2
|
-
const propTypes = require('prop-types');
|
|
3
|
-
const React = require('react');
|
|
4
|
-
|
|
5
|
-
const Favicon = ({ src, alt = 'favicon', ...attr }) => <img {...attr} alt={alt} height="14" src={src} width="14" />;
|
|
6
|
-
Favicon.propTypes = {
|
|
7
|
-
alt: propTypes.string,
|
|
8
|
-
src: propTypes.string,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
class Embed extends React.Component {
|
|
12
|
-
render() {
|
|
13
|
-
const { lazy = true, provider, url, title, html, iframe, image, favicon, ...attrs } = this.props;
|
|
14
|
-
|
|
15
|
-
if (!url) {
|
|
16
|
-
return <div />;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if ('iframe' in this.props) {
|
|
20
|
-
return <iframe {...attrs} border="none" src={url} style={{ border: 'none', display: 'flex', margin: 'auto' }} />;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const classes = ['embed', image && 'embed_hasImg'];
|
|
24
|
-
return (
|
|
25
|
-
<div className={classes.join(' ')}>
|
|
26
|
-
{html ? (
|
|
27
|
-
<div className="embed-media" dangerouslySetInnerHTML={{ __html: html }}></div>
|
|
28
|
-
) : (
|
|
29
|
-
<a className="embed-link" href={url} rel="noopener noreferrer" target="_blank">
|
|
30
|
-
{!image || <img alt={title} className="embed-img" loading={lazy ? 'lazy' : ''} src={image} />}
|
|
31
|
-
{title ? (
|
|
32
|
-
<div className="embed-body">
|
|
33
|
-
{!favicon || (
|
|
34
|
-
<Favicon
|
|
35
|
-
alt={provider}
|
|
36
|
-
className="embed-favicon"
|
|
37
|
-
loading={lazy ? 'lazy' : ''}
|
|
38
|
-
src={favicon}
|
|
39
|
-
style={{ float: 'left' }}
|
|
40
|
-
/>
|
|
41
|
-
)}
|
|
42
|
-
{provider && (
|
|
43
|
-
<small className="embed-provider">
|
|
44
|
-
{provider.search(/^@{1}/) < 0 ? (
|
|
45
|
-
provider
|
|
46
|
-
) : (
|
|
47
|
-
<code style={{ fontFamily: 'var(--md-code-font, monospace)' }}>{url}</code>
|
|
48
|
-
)}
|
|
49
|
-
</small>
|
|
50
|
-
)}
|
|
51
|
-
<div className="embed-title">{title}</div>
|
|
52
|
-
</div>
|
|
53
|
-
) : (
|
|
54
|
-
<div className="embed-body">
|
|
55
|
-
<b>View</b>: <span className="embed-body-url">{url}</span>
|
|
56
|
-
</div>
|
|
57
|
-
)}
|
|
58
|
-
</a>
|
|
59
|
-
)}
|
|
60
|
-
</div>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
Embed.propTypes = {
|
|
66
|
-
children: propTypes.oneOfType([propTypes.string, propTypes.array, propTypes.shape({}), propTypes.element]),
|
|
67
|
-
favicon: propTypes.string,
|
|
68
|
-
height: propTypes.string,
|
|
69
|
-
html: propTypes.string,
|
|
70
|
-
iframe: propTypes.any,
|
|
71
|
-
image: propTypes.string,
|
|
72
|
-
lazy: propTypes.bool,
|
|
73
|
-
provider: propTypes.string,
|
|
74
|
-
title: propTypes.string,
|
|
75
|
-
url: propTypes.oneOfType([propTypes.string, propTypes.shape({})]),
|
|
76
|
-
width: propTypes.string,
|
|
77
|
-
};
|
|
78
|
-
Embed.defaultProps = {
|
|
79
|
-
height: '300px',
|
|
80
|
-
width: '100%',
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const CreateEmbed =
|
|
84
|
-
({ lazyImages }) =>
|
|
85
|
-
// eslint-disable-next-line react/display-name
|
|
86
|
-
props =>
|
|
87
|
-
<Embed {...props} lazy={lazyImages} />;
|
|
88
|
-
|
|
89
|
-
module.exports = CreateEmbed;
|