@readme/markdown 6.74.1 → 6.75.0-beta.1
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/README.md +13 -17
- package/components/Anchor.jsx +1 -1
- package/components/Callout/index.jsx +3 -3
- package/components/Callout/style.scss +27 -60
- package/components/Code/index.jsx +0 -2
- package/components/Code/style.scss +81 -72
- package/components/CodeTabs/index.jsx +4 -15
- package/components/CodeTabs/style.scss +22 -30
- package/components/Embed/style.scss +59 -67
- package/components/GlossaryItem/style.scss +11 -22
- package/components/Heading/style.scss +9 -15
- package/components/Image/index.jsx +6 -3
- package/components/Image/style.scss +63 -64
- package/components/Table/style.scss +17 -23
- package/dist/main.css +7 -14
- package/dist/main.js +61975 -27904
- package/dist/main.node.js +2 -34778
- package/dist/main.node.js.LICENSE.txt +50 -0
- package/package.json +53 -66
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@readme/markdown
|
|
2
|
-
|
|
1
|
+
# @readme/markdown
|
|
2
|
+
|
|
3
3
|
<img align="right" width="26%" src="https://owlbertsio-resized.s3.amazonaws.com/Reading.psd.full.png">
|
|
4
4
|
|
|
5
5
|
ReadMe's flavored Markdown parser and MDX rendering engine. <img align=center src=https://github.com/readmeio/markdown/workflows/CI/badge.svg alt="RDMD CI Status">
|
|
@@ -14,28 +14,24 @@ By default, the updated markdown package exports a function which takes a string
|
|
|
14
14
|
|
|
15
15
|
```jsx
|
|
16
16
|
import React from 'react';
|
|
17
|
-
import rdmd from
|
|
17
|
+
import rdmd from '@readme/markdown';
|
|
18
18
|
|
|
19
|
-
export default ({ body }) => (
|
|
20
|
-
<div className="markdown-body">
|
|
21
|
-
{rdmd(body)}
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
19
|
+
export default ({ body }) => <div className="markdown-body">{rdmd(body)}</div>;
|
|
24
20
|
```
|
|
25
21
|
|
|
26
22
|
### Export Methods
|
|
27
23
|
|
|
28
24
|
In addition to the default React processor, the package exports some other methods for transforming ReadMe-flavored markdown:
|
|
29
25
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
| Export | Description | Arguments |
|
|
27
|
+
| --------: | :--------------------------------------------- | :---------------- |
|
|
28
|
+
| _`react`_ | _(default)_ returns a VDOM tree object | `text`, `options` |
|
|
29
|
+
| _`md`_ | transform mdast in to ReadMe-flavored markdown | `tree`, `options` |
|
|
30
|
+
| _`html`_ | transform markdown in to HTML | `text`, `options` |
|
|
31
|
+
| _`mdast`_ | transform markdown to an mdast object | `text`, `options` |
|
|
32
|
+
| _`hast`_ | transform markdown to HAST object | `text`, `options` |
|
|
33
|
+
| _`plain`_ | transform markdown to plain text | `text`, `options` |
|
|
34
|
+
| _`utils`_ | contexts, defaults, helpers, etc. | N/A |
|
|
39
35
|
|
|
40
36
|
### Settings & Options
|
|
41
37
|
|
package/components/Anchor.jsx
CHANGED
|
@@ -18,7 +18,7 @@ function getHref(href, baseUrl) {
|
|
|
18
18
|
|
|
19
19
|
const ref = path.match(/^ref:([-_a-zA-Z0-9#]*)$/);
|
|
20
20
|
if (ref) {
|
|
21
|
-
return `${base}/reference/${ref[1]}${hashStr}`;
|
|
21
|
+
return `${base}/reference-link/${ref[1]}${hashStr}`;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// we need to perform two matches for changelogs in case
|
|
@@ -6,12 +6,12 @@ const Callout = props => {
|
|
|
6
6
|
const [title, ...content] = !props.title ? [null, props.children] : props.children;
|
|
7
7
|
|
|
8
8
|
return (
|
|
9
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
9
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
10
10
|
<blockquote {...attributes} className={`callout callout_${theme}`} theme={icon}>
|
|
11
|
-
<
|
|
11
|
+
<h3 className={`callout-heading${title ? '' : ' empty'}`}>
|
|
12
12
|
<span className="callout-icon">{icon}</span>
|
|
13
13
|
{title}
|
|
14
|
-
</
|
|
14
|
+
</h3>
|
|
15
15
|
{content}
|
|
16
16
|
</blockquote>
|
|
17
17
|
);
|
|
@@ -1,104 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
/* stylelint-disable font-family-no-missing-generic-family-keyword */
|
|
3
|
-
/* stylelint-disable order/properties-alphabetical-order */
|
|
4
|
-
/* stylelint-disable order/order */
|
|
5
|
-
@mixin callout($l-offset: 1.33rem) {
|
|
1
|
+
@mixin callout ($l-offset: 1.33rem) {
|
|
6
2
|
--background: #{lighten(#dfe2e5, 8.75%)};
|
|
7
3
|
--border: #{lighten(#6a737d, 12.5%)};
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
& {
|
|
6
|
+
background: var(--background);
|
|
7
|
+
border-color: var(--border);
|
|
8
|
+
color: var(--text);
|
|
9
|
+
padding: $l-offset;
|
|
10
|
+
}
|
|
13
11
|
|
|
14
12
|
&_info {
|
|
15
13
|
$color: #46b8da;
|
|
16
|
-
|
|
17
14
|
--background: #e3edf2;
|
|
18
15
|
--title: #{$color};
|
|
19
16
|
--border: #{lighten($color, 5%)}; // should be #5bc0de
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
&_warn,
|
|
23
|
-
&_warning {
|
|
19
|
+
&_warn, &_warning {
|
|
24
20
|
$color: #eea236;
|
|
25
|
-
|
|
26
21
|
--background: #fcf8f2;
|
|
27
22
|
--title: #{$color};
|
|
28
23
|
--border: #{lighten($color, 5%)};
|
|
29
24
|
}
|
|
30
25
|
|
|
31
|
-
&_ok,
|
|
32
|
-
&_okay,
|
|
33
|
-
&_success {
|
|
26
|
+
&_ok, &_okay, &_success {
|
|
34
27
|
$color: #489e49;
|
|
35
|
-
|
|
36
28
|
--background: #f3f8f3;
|
|
37
29
|
--title: #{$color};
|
|
38
30
|
--border: #{lighten($color, 5%)}; // should be #50af51
|
|
39
31
|
}
|
|
40
32
|
|
|
41
|
-
&_err,
|
|
42
|
-
&_error {
|
|
33
|
+
&_err, &_error {
|
|
43
34
|
$color: #d43f3a;
|
|
44
|
-
|
|
45
35
|
--background: #fdf7f7;
|
|
46
36
|
--title: #{$color};
|
|
47
|
-
--border: #{lighten($color, 5%)};
|
|
37
|
+
--border: #{lighten($color, 5%)}; // should be #d9534f
|
|
48
38
|
}
|
|
49
39
|
|
|
50
40
|
> * {
|
|
51
41
|
margin-left: $l-offset;
|
|
52
42
|
position: relative;
|
|
53
43
|
}
|
|
54
|
-
|
|
55
|
-
ul,
|
|
56
|
-
ol {
|
|
44
|
+
ul, ol {
|
|
57
45
|
padding-left: 1.3em;
|
|
58
46
|
}
|
|
59
47
|
|
|
60
48
|
a {
|
|
61
49
|
color: inherit;
|
|
62
50
|
}
|
|
63
|
-
|
|
64
51
|
hr {
|
|
65
52
|
border-color: var(--border, var(--markdown-edge, #eee));
|
|
66
53
|
}
|
|
67
|
-
|
|
68
54
|
blockquote {
|
|
69
55
|
color: var(--text);
|
|
70
56
|
border-color: var(--border);
|
|
71
57
|
border-width: 3px;
|
|
72
|
-
padding: 0 0 0
|
|
58
|
+
padding: 0 0 0 .8em;
|
|
73
59
|
}
|
|
74
60
|
|
|
75
61
|
.callout-heading {
|
|
76
62
|
color: var(--title, --text);
|
|
77
|
-
|
|
78
|
-
font-family: var(--markdown-title-font); // match h3
|
|
79
|
-
font-weight: var(--markdown-title-weight, 600); // match h3
|
|
80
|
-
line-height: 1.25; // match h3
|
|
81
|
-
margin-bottom: calc(#{$l-offset} * 0.5);
|
|
82
|
-
|
|
63
|
+
margin-bottom: calc(#{$l-offset} * .5);
|
|
83
64
|
&:only-child {
|
|
84
65
|
margin-bottom: 0;
|
|
85
66
|
}
|
|
86
|
-
|
|
87
67
|
&.empty {
|
|
88
68
|
float: left;
|
|
89
|
-
margin-top: calc(#{$l-offset} *
|
|
90
|
-
|
|
69
|
+
margin-top: calc(#{$l-offset} * .5);
|
|
91
70
|
.callout-icon {
|
|
92
71
|
line-height: 0;
|
|
93
72
|
}
|
|
94
73
|
}
|
|
95
|
-
|
|
96
74
|
> * {
|
|
97
75
|
color: inherit;
|
|
98
76
|
margin: 0;
|
|
99
77
|
}
|
|
100
|
-
|
|
101
|
-
&::before {
|
|
78
|
+
&:before {
|
|
102
79
|
position: absolute;
|
|
103
80
|
right: 100%;
|
|
104
81
|
width: 2.4em;
|
|
@@ -106,23 +83,20 @@
|
|
|
106
83
|
font: normal normal normal 1em/1 FontAwesome;
|
|
107
84
|
}
|
|
108
85
|
}
|
|
109
|
-
|
|
110
86
|
.callout-icon {
|
|
111
87
|
float: left;
|
|
112
|
-
margin-left: calc(-#{$l-offset} -
|
|
113
|
-
margin-right:
|
|
88
|
+
margin-left: calc(-#{$l-offset} - .5em);
|
|
89
|
+
margin-right: -.25rem;
|
|
114
90
|
}
|
|
115
91
|
}
|
|
116
|
-
@mixin
|
|
92
|
+
@mixin calloutCustomIcons($R: callout) {
|
|
117
93
|
--emoji: 1em;
|
|
118
|
-
--icon-font:
|
|
119
|
-
|
|
94
|
+
--icon-font: FontAwesome;
|
|
120
95
|
&-icon {
|
|
121
96
|
font-size: var(--emoji, 0);
|
|
122
97
|
color: var(--icon-color, inherit) !important;
|
|
123
98
|
}
|
|
124
|
-
|
|
125
|
-
&-icon::before {
|
|
99
|
+
&-icon:before {
|
|
126
100
|
content: var(--icon);
|
|
127
101
|
font-family: var(--icon-font);
|
|
128
102
|
font-size: var(--icon-size, 1rem);
|
|
@@ -137,27 +111,22 @@
|
|
|
137
111
|
}
|
|
138
112
|
@at-root .rdmdCallouts--useIconFont & {
|
|
139
113
|
--emoji: unset;
|
|
140
|
-
|
|
141
114
|
&_okay {
|
|
142
115
|
/* thumbs up */
|
|
143
|
-
--icon:
|
|
116
|
+
--icon: "\f164";
|
|
144
117
|
}
|
|
145
|
-
|
|
146
118
|
&_info {
|
|
147
119
|
/* info circle */
|
|
148
|
-
--icon:
|
|
120
|
+
--icon: "\f05a";
|
|
149
121
|
}
|
|
150
|
-
|
|
151
122
|
&_warn {
|
|
152
123
|
/* warning triangle */
|
|
153
|
-
--icon:
|
|
124
|
+
--icon: "\f071";
|
|
154
125
|
}
|
|
155
|
-
|
|
156
126
|
&_error {
|
|
157
127
|
/* warning circle */
|
|
158
|
-
--icon:
|
|
128
|
+
--icon: "\f06a";
|
|
159
129
|
}
|
|
160
|
-
|
|
161
130
|
&_default {
|
|
162
131
|
/* warning circle */
|
|
163
132
|
--emoji: 1rem;
|
|
@@ -166,12 +135,10 @@
|
|
|
166
135
|
}
|
|
167
136
|
|
|
168
137
|
.callout {
|
|
169
|
-
&.callout {
|
|
170
|
-
// bump specificity
|
|
138
|
+
&.callout { // bump specificity
|
|
171
139
|
@include callout;
|
|
172
140
|
}
|
|
173
|
-
@include
|
|
174
|
-
|
|
141
|
+
@include calloutCustomIcons;
|
|
175
142
|
border-top-right-radius: var(--markdown-radius);
|
|
176
143
|
border-bottom-right-radius: var(--markdown-radius);
|
|
177
144
|
}
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/* stylelint-disable font-family-no-missing-generic-family-keyword */
|
|
4
|
-
/* stylelint-disable declaration-property-value-disallowed-list */
|
|
5
|
-
/* stylelint-disable scss/selector-no-redundant-nesting-selector */
|
|
6
|
-
/* stylelint-disable order/properties-alphabetical-order */
|
|
7
|
-
@mixin gfm-code-base-styles($background: #f6f8fa, $background-dark: #242e34, $text: inherit) {
|
|
1
|
+
@mixin gfmCodeBaseStyles($background: #F6F8FA, $background-dark: #242E34, $text: inherit) {
|
|
2
|
+
|
|
8
3
|
code,
|
|
9
4
|
kbd,
|
|
10
5
|
pre {
|
|
11
|
-
font-family: SFMono-Regular, Consolas,
|
|
6
|
+
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
|
|
12
7
|
font-family: var(--md-code-font, SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace);
|
|
13
|
-
font-size: 1em
|
|
8
|
+
font-size: 1em
|
|
14
9
|
}
|
|
15
10
|
|
|
16
11
|
code,
|
|
17
12
|
pre {
|
|
18
|
-
font-size: 12px
|
|
13
|
+
font-size: 12px
|
|
19
14
|
}
|
|
20
15
|
|
|
21
16
|
pre {
|
|
22
17
|
margin-bottom: 0;
|
|
23
|
-
margin-top: 0
|
|
24
|
-
word-wrap: normal;
|
|
18
|
+
margin-top: 0
|
|
25
19
|
}
|
|
26
20
|
|
|
27
21
|
code {
|
|
@@ -31,21 +25,25 @@
|
|
|
31
25
|
color: var(--md-code-text);
|
|
32
26
|
font-size: 85%;
|
|
33
27
|
margin: 0;
|
|
34
|
-
padding:
|
|
28
|
+
padding: .2em .4em;
|
|
35
29
|
|
|
36
|
-
>
|
|
30
|
+
>div[class*="cm-"] {
|
|
37
31
|
display: inherit;
|
|
38
32
|
}
|
|
39
33
|
}
|
|
40
34
|
|
|
41
|
-
pre
|
|
35
|
+
pre {
|
|
36
|
+
word-wrap: normal
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
pre>code {
|
|
42
40
|
background: 0 0;
|
|
43
41
|
border: 0;
|
|
44
42
|
font-size: 100%;
|
|
45
43
|
margin: 0;
|
|
46
44
|
padding: 0;
|
|
47
45
|
white-space: pre;
|
|
48
|
-
word-break: normal
|
|
46
|
+
word-break: normal
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
pre {
|
|
@@ -59,7 +57,7 @@
|
|
|
59
57
|
font-size: 85%;
|
|
60
58
|
line-height: 1.45;
|
|
61
59
|
overflow: auto;
|
|
62
|
-
padding: 1em
|
|
60
|
+
padding: 1em
|
|
63
61
|
}
|
|
64
62
|
|
|
65
63
|
pre code.theme-dark {
|
|
@@ -76,7 +74,7 @@
|
|
|
76
74
|
max-width: auto;
|
|
77
75
|
overflow: visible;
|
|
78
76
|
padding: 0;
|
|
79
|
-
word-wrap: normal
|
|
77
|
+
word-wrap: normal
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
kbd {
|
|
@@ -91,78 +89,89 @@
|
|
|
91
89
|
font-size: 11px;
|
|
92
90
|
line-height: 10px;
|
|
93
91
|
padding: 3px 5px;
|
|
94
|
-
vertical-align: middle
|
|
92
|
+
vertical-align: middle
|
|
95
93
|
}
|
|
96
94
|
}
|
|
97
95
|
|
|
98
|
-
@mixin
|
|
96
|
+
@mixin copyCodeButton {
|
|
99
97
|
button.rdmd-code-copy {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
98
|
+
DISPLAY: none !important; // hide by default
|
|
99
|
+
|
|
100
|
+
& {
|
|
101
|
+
-webkit-appearance: unset;
|
|
102
|
+
margin: .5em .6em 0 0;
|
|
103
|
+
padding: .25em .7em;
|
|
104
|
+
cursor: copy;
|
|
105
|
+
font: inherit;
|
|
106
|
+
color: inherit;
|
|
107
|
+
color: var(--md-code-text, inherit);
|
|
108
|
+
border: none;
|
|
109
|
+
border-radius: 3px;
|
|
110
|
+
outline: none !important;
|
|
111
|
+
background: inherit;
|
|
112
|
+
background: var(--md-code-background, inherit);
|
|
113
|
+
box-shadow:
|
|
114
|
+
inset 0 0 0 1px rgba(#aaa, .66),
|
|
115
|
+
-1px 2px 6px -3px rgba(black, .1);
|
|
116
|
+
transition: .15s ease-out;
|
|
117
|
+
}
|
|
115
118
|
|
|
116
119
|
&:not(:hover) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
|
|
121
|
+
&:before,
|
|
122
|
+
&:after {
|
|
123
|
+
opacity: .66;
|
|
120
124
|
}
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
&:hover {
|
|
124
128
|
&:not(:active) {
|
|
125
|
-
box-shadow:
|
|
129
|
+
box-shadow:
|
|
130
|
+
inset 0 0 0 1px rgba(#8B8B8B, .75),
|
|
131
|
+
-1px 2px 6px -3px rgba(black, .2);
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
134
|
|
|
129
135
|
&:active {
|
|
130
|
-
box-shadow:
|
|
136
|
+
box-shadow:
|
|
137
|
+
inset 0 0 0 1px rgba(#8B8B8B, .5),
|
|
138
|
+
inset 1px 4px 6px -2px rgba(0, 0, 0, .175);
|
|
131
139
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
opacity:
|
|
140
|
+
&:before,
|
|
141
|
+
&:after {
|
|
142
|
+
opacity: .75;
|
|
135
143
|
}
|
|
136
144
|
}
|
|
137
145
|
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
&:before,
|
|
147
|
+
&:after {
|
|
140
148
|
display: inline-block;
|
|
141
|
-
font: normal normal normal 1em/1
|
|
142
|
-
font-family: ReadMe-Icons;
|
|
143
|
-
font-feature-settings: 'liga';
|
|
144
|
-
font-variant-ligatures: discretionary-ligatures;
|
|
145
|
-
line-height: 2;
|
|
149
|
+
font: normal normal normal 1em/1 "Font Awesome 5 Free", "FontAwesome";
|
|
146
150
|
text-rendering: auto;
|
|
147
151
|
-webkit-font-smoothing: antialiased;
|
|
152
|
+
|
|
153
|
+
line-height: 2;
|
|
154
|
+
font-family: 'ReadMe-Icons';
|
|
155
|
+
font-variant-ligatures: discretionary-ligatures;
|
|
156
|
+
font-feature-settings: "liga";
|
|
148
157
|
}
|
|
149
158
|
|
|
150
|
-
|
|
151
|
-
content:
|
|
159
|
+
&:before {
|
|
160
|
+
content: "\e6c9";
|
|
152
161
|
font-weight: 800;
|
|
153
|
-
transition:
|
|
162
|
+
transition: .3s .15s ease;
|
|
154
163
|
}
|
|
155
164
|
|
|
156
|
-
|
|
165
|
+
&:after {
|
|
157
166
|
// @todo why are these !important @rafe, you dumbell?
|
|
158
|
-
content:
|
|
167
|
+
content: "\e942" !important;
|
|
159
168
|
font-weight: 900 !important;
|
|
160
|
-
left: 50%;
|
|
161
|
-
opacity: 0 !important;
|
|
162
169
|
position: absolute;
|
|
163
170
|
top: 50%;
|
|
164
|
-
|
|
165
|
-
|
|
171
|
+
left: 50%;
|
|
172
|
+
transform: translate(-50%, -50%) scale(.33);
|
|
173
|
+
opacity: 0 !important;
|
|
174
|
+
transition: .3s 0s ease;
|
|
166
175
|
}
|
|
167
176
|
|
|
168
177
|
&_copied {
|
|
@@ -175,16 +184,16 @@
|
|
|
175
184
|
opacity: 1;
|
|
176
185
|
}
|
|
177
186
|
|
|
178
|
-
|
|
187
|
+
&:before {
|
|
188
|
+
transition: .3s 0s ease;
|
|
189
|
+
transform: scale(.33);
|
|
179
190
|
opacity: 0 !important;
|
|
180
|
-
transition: 0.3s 0s ease;
|
|
181
|
-
transform: scale(0.33);
|
|
182
191
|
}
|
|
183
192
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
transition: 0.3s 0.15s ease;
|
|
193
|
+
&:after {
|
|
194
|
+
transition: .3s .15s ease;
|
|
187
195
|
transform: translate(-50%, -50%) scale(1);
|
|
196
|
+
opacity: 1 !important;
|
|
188
197
|
}
|
|
189
198
|
}
|
|
190
199
|
}
|
|
@@ -192,11 +201,11 @@
|
|
|
192
201
|
pre {
|
|
193
202
|
position: relative;
|
|
194
203
|
|
|
195
|
-
>
|
|
204
|
+
>code {
|
|
196
205
|
background: inherit;
|
|
197
206
|
}
|
|
198
207
|
|
|
199
|
-
>
|
|
208
|
+
>code.theme-dark {
|
|
200
209
|
color: white;
|
|
201
210
|
}
|
|
202
211
|
|
|
@@ -212,7 +221,7 @@
|
|
|
212
221
|
overflow: hidden;
|
|
213
222
|
padding: 0;
|
|
214
223
|
|
|
215
|
-
>
|
|
224
|
+
>code {
|
|
216
225
|
display: block !important;
|
|
217
226
|
overflow: auto;
|
|
218
227
|
padding: 1em;
|
|
@@ -223,7 +232,7 @@
|
|
|
223
232
|
// manage copied state style
|
|
224
233
|
& {
|
|
225
234
|
&:hover button.rdmd-code-copy:not(:hover) {
|
|
226
|
-
transition-delay:
|
|
235
|
+
transition-delay: .4s;
|
|
227
236
|
}
|
|
228
237
|
|
|
229
238
|
&:not(:hover) button.rdmd-code-copy:not(.rdmd-code-copy_copied) {
|
|
@@ -234,7 +243,7 @@
|
|
|
234
243
|
}
|
|
235
244
|
|
|
236
245
|
.markdown-body {
|
|
237
|
-
// --md-code-background: #F6F8FA;
|
|
238
|
-
@include
|
|
239
|
-
@include
|
|
246
|
+
// --md-code-background: #F6F8FA;
|
|
247
|
+
@include gfmCodeBaseStyles;
|
|
248
|
+
@include copyCodeButton;
|
|
240
249
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
const { uppercase } = require('@readme/syntax-highlighter');
|
|
2
2
|
const PropTypes = require('prop-types');
|
|
3
3
|
const React = require('react');
|
|
4
|
-
const { useState } = require('react');
|
|
5
4
|
|
|
6
5
|
const CodeTabs = props => {
|
|
7
6
|
const { children, theme } = props;
|
|
8
|
-
const [activeIndex, setActiveIndex] = useState(0);
|
|
9
7
|
|
|
10
8
|
function handleClick({ target }, index) {
|
|
11
9
|
const $wrap = target.parentElement.parentElement;
|
|
@@ -16,32 +14,23 @@ const CodeTabs = props => {
|
|
|
16
14
|
const codeblocks = $wrap.querySelectorAll('pre');
|
|
17
15
|
codeblocks[index].classList.add('CodeTabs_active');
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
target.classList.add('CodeTabs_active');
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
return (
|
|
23
21
|
<div className={`CodeTabs CodeTabs_initial theme-${theme}`}>
|
|
24
|
-
<div className="CodeTabs-toolbar"
|
|
22
|
+
<div className="CodeTabs-toolbar">
|
|
25
23
|
{children.map(({ props: pre }, i) => {
|
|
26
24
|
const { meta, lang } = pre.children[0].props;
|
|
27
25
|
/* istanbul ignore next */
|
|
28
26
|
return (
|
|
29
|
-
<button
|
|
30
|
-
key={i}
|
|
31
|
-
aria-selected={activeIndex === i}
|
|
32
|
-
className={activeIndex === i ? 'CodeTabs_active' : ''}
|
|
33
|
-
onClick={e => handleClick(e, i)}
|
|
34
|
-
role="tab"
|
|
35
|
-
type="button"
|
|
36
|
-
>
|
|
27
|
+
<button key={i} onClick={e => handleClick(e, i)} type="button">
|
|
37
28
|
{meta || `${!lang ? 'Text' : uppercase(lang)}`}
|
|
38
29
|
</button>
|
|
39
30
|
);
|
|
40
31
|
})}
|
|
41
32
|
</div>
|
|
42
|
-
<div className="CodeTabs-inner"
|
|
43
|
-
{children}
|
|
44
|
-
</div>
|
|
33
|
+
<div className="CodeTabs-inner">{children}</div>
|
|
45
34
|
</div>
|
|
46
35
|
);
|
|
47
36
|
};
|