@readme/markdown 6.74.2 → 6.75.0-beta.2

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.
@@ -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, react/no-unknown-property
9
+ // eslint-disable-next-line react/jsx-props-no-spreading
10
10
  <blockquote {...attributes} className={`callout callout_${theme}`} theme={icon}>
11
- <h2 className={`callout-heading${title ? '' : ' empty'}`}>
11
+ <h3 className={`callout-heading${title ? '' : ' empty'}`}>
12
12
  <span className="callout-icon">{icon}</span>
13
13
  {title}
14
- </h2>
14
+ </h3>
15
15
  {content}
16
16
  </blockquote>
17
17
  );
@@ -1,104 +1,81 @@
1
- /* stylelint-disable no-descending-specificity */
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
- background: var(--background);
10
- border-color: var(--border);
11
- color: var(--text);
12
- padding: $l-offset;
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%)}; // should be #d9534f
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 0.8em;
58
+ padding: 0 0 0 .8em;
73
59
  }
74
60
 
75
61
  .callout-heading {
76
62
  color: var(--title, --text);
77
- font-size: 1.25em; // match h3
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} * 0.5);
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} - 0.5em);
113
- margin-right: -0.25rem;
88
+ margin-left: calc(-#{$l-offset} - .5em);
89
+ margin-right: -.25rem;
114
90
  }
115
91
  }
116
- @mixin callout-custom-icons($R: callout) {
92
+ @mixin calloutCustomIcons($R: callout) {
117
93
  --emoji: 1em;
118
- --icon-font: fontawesome;
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: '\f164';
116
+ --icon: "\f164";
144
117
  }
145
-
146
118
  &_info {
147
119
  /* info circle */
148
- --icon: '\f05a';
120
+ --icon: "\f05a";
149
121
  }
150
-
151
122
  &_warn {
152
123
  /* warning triangle */
153
- --icon: '\f071';
124
+ --icon: "\f071";
154
125
  }
155
-
156
126
  &_error {
157
127
  /* warning circle */
158
- --icon: '\f06a';
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 callout-custom-icons;
174
-
141
+ @include calloutCustomIcons;
175
142
  border-top-right-radius: var(--markdown-radius);
176
143
  border-bottom-right-radius: var(--markdown-radius);
177
144
  }
@@ -63,8 +63,6 @@ function Code(props) {
63
63
  data-lang={language}
64
64
  name={meta}
65
65
  suppressHydrationWarning={true}
66
- // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
67
- tabIndex={0}
68
66
  >
69
67
  {codeContent}
70
68
  </code>
@@ -1,27 +1,21 @@
1
- /* stylelint-disable no-duplicate-selectors */
2
- /* stylelint-disable no-descending-specificity */
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, 'Liberation Mono', Menlo, Courier, monospace;
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: 0.2em 0.4em;
28
+ padding: .2em .4em;
35
29
 
36
- > div[class*='cm-'] {
30
+ >div[class*="cm-"] {
37
31
  display: inherit;
38
32
  }
39
33
  }
40
34
 
41
- pre > code {
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 copy-code-button {
96
+ @mixin copyCodeButton {
99
97
  button.rdmd-code-copy {
100
- appearance: unset;
101
- background: inherit;
102
- background: var(--md-code-background, inherit);
103
- border: none;
104
- border-radius: 3px;
105
- box-shadow: inset 0 0 0 1px rgba(#aaa, 0.66), -1px 2px 6px -3px rgba(black, 0.1);
106
- color: inherit;
107
- color: var(--md-code-text, inherit);
108
- cursor: copy;
109
- display: none !important; // hide by default
110
- font: inherit;
111
- margin: 0.5em 0.6em 0 0;
112
- outline: none !important;
113
- padding: 0.25em 0.7em;
114
- transition: 0.15s ease-out;
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
- &::before,
118
- &::after {
119
- opacity: 0.66;
120
+
121
+ &:before,
122
+ &:after {
123
+ opacity: .66;
120
124
  }
121
125
  }
122
126
 
123
127
  &:hover {
124
128
  &:not(:active) {
125
- box-shadow: inset 0 0 0 1px rgba(#8b8b8b, 0.75), -1px 2px 6px -3px rgba(black, 0.2);
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: inset 0 0 0 1px rgba(#8b8b8b, 0.5), inset 1px 4px 6px -2px rgba(0, 0, 0, 0.175);
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
- &::before,
133
- &::after {
134
- opacity: 0.75;
140
+ &:before,
141
+ &:after {
142
+ opacity: .75;
135
143
  }
136
144
  }
137
145
 
138
- &::before,
139
- &::after {
146
+ &:before,
147
+ &:after {
140
148
  display: inline-block;
141
- font: normal normal normal 1em/1 'Font Awesome 5 Free', FontAwesome;
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
- &::before {
151
- content: '\e6c9';
159
+ &:before {
160
+ content: "\e6c9";
152
161
  font-weight: 800;
153
- transition: 0.3s 0.15s ease;
162
+ transition: .3s .15s ease;
154
163
  }
155
164
 
156
- &::after {
165
+ &:after {
157
166
  // @todo why are these !important @rafe, you dumbell?
158
- content: '\e942' !important;
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
- transform: translate(-50%, -50%) scale(0.33);
165
- transition: 0.3s 0s ease;
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
- &::before {
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
- &::after {
185
- opacity: 1 !important;
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
- > code {
204
+ >code {
196
205
  background: inherit;
197
206
  }
198
207
 
199
- > code.theme-dark {
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
- > code {
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: 0.4s;
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 gfm-code-base-styles;
239
- @include copy-code-button;
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
- setActiveIndex(index);
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" role="tablist">
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" role="tabpanel">
43
- {children}
44
- </div>
33
+ <div className="CodeTabs-inner">{children}</div>
45
34
  </div>
46
35
  );
47
36
  };
@@ -1,24 +1,21 @@
1
- /* stylelint-disable no-descending-specificity */
2
- /* stylelint-disable declaration-property-value-disallowed-list */
3
1
  @import '~codemirror/lib/codemirror.css';
4
2
  @import '~codemirror/theme/neo.css';
5
3
 
6
- @mixin code-tabs {
7
- $bgc-pre: #f6f8fa;
8
- $bgc-pre-dark: #242e34;
4
+ @mixin CodeTabs {
5
+ $bgc-pre: #F6F8FA;
6
+ $bgc-pre-dark: #242E34;
9
7
  $bgc-bar: darken(desaturate($bgc-pre, 17.46), 4.31);
10
8
  $bgc-bar-dark: lighten(desaturate($bgc-pre-dark, 17.46), 4.31);
11
9
  $radius: var(--md-code-radius, var(--markdown-radius, 3px));
12
10
 
13
- border-radius: $radius !important;
14
11
  color: #333;
15
12
  color: var(--md-code-text, #333);
13
+ border-radius: $radius !important;
16
14
  overflow: hidden;
17
15
 
18
16
  &.theme-dark {
19
17
  color: white;
20
18
  color: var(--md-code-text, white);
21
-
22
19
  .CodeTabs-toolbar {
23
20
  background: $bgc-bar-dark;
24
21
  background: var(--md-code-tabs, $bgc-bar-dark);
@@ -31,28 +28,27 @@
31
28
  display: flex;
32
29
  flex-flow: row nowrap;
33
30
  overflow: hidden;
34
- -webkit-overflow-scrolling: touch;
35
- -ms-overflow-style: none;
36
31
  overflow-x: auto;
37
-
32
+ -ms-overflow-style: none;
33
+ -webkit-overflow-scrolling: touch;
38
34
  &::-webkit-scrollbar {
39
35
  display: none;
40
36
  }
41
-
42
37
  button {
38
+ white-space: nowrap;
39
+ transition: .123s ease;
40
+ -webkit-appearance: none;
43
41
  appearance: none;
44
- background: transparent;
45
- border: none;
46
- color: inherit;
47
- cursor: pointer;
48
42
  display: inline-block;
49
- font: inherit;
50
- font-size: 0.75em;
51
43
  line-height: 2;
44
+ padding: .5em 1em;
45
+ border: none;
46
+ background: transparent;
52
47
  outline: none;
53
- padding: 0.5em 1em;
54
- transition: 0.123s ease;
55
- white-space: nowrap;
48
+ color: inherit;
49
+ font: inherit;
50
+ font-size: .75em;
51
+ cursor: pointer;
56
52
  }
57
53
  }
58
54
 
@@ -73,20 +69,16 @@
73
69
  color: var(--md-code-text, white);
74
70
  }
75
71
 
76
- &-toolbar button:not(.CodeTabs_active):hover,
77
- &-toolbar button:not(.CodeTabs_active):active,
78
- &-toolbar button:not(.CodeTabs_active):focus {
79
- background: rgba(0, 0, 0, 0.075);
72
+ &-toolbar button:not(.CodeTabs_active):hover {
73
+ background: rgba(0, 0, 0, .075);
80
74
  }
81
75
 
82
76
  pre {
83
- background: var(--md-code-background, $bgc-pre);
84
77
  border-radius: 0 0 $radius $radius !important;
78
+ background: $bgc-pre;
79
+ background: var(--md-code-background, $bgc-pre);
85
80
  margin-bottom: 0;
86
-
87
- &:not(.CodeTabs_active) {
88
- display: none;
89
- }
81
+ &:not(.CodeTabs_active) { display: none }
90
82
  }
91
83
 
92
84
  &.theme-dark pre {
@@ -100,5 +92,5 @@
100
92
  }
101
93
 
102
94
  .CodeTabs {
103
- @include code-tabs;
95
+ @include CodeTabs;
104
96
  }