@readme/markdown 6.51.0 → 6.52.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/components/Anchor.jsx +13 -9
- package/components/Code/index.jsx +1 -1
- package/dist/main.js +39 -21
- package/dist/main.node.js +39 -21
- package/package.json +1 -1
package/components/Anchor.jsx
CHANGED
|
@@ -6,29 +6,33 @@ const BaseUrlContext = require('../contexts/BaseUrl');
|
|
|
6
6
|
// Nabbed from here:
|
|
7
7
|
// https://github.com/readmeio/api-explorer/blob/0dedafcf71102feedaa4145040d3f57d79d95752/packages/api-explorer/src/lib/markdown/renderer.js#L52
|
|
8
8
|
function getHref(href, baseUrl) {
|
|
9
|
+
const [path, hash] = href.split('#');
|
|
10
|
+
const hashStr = hash ? `#${hash}` : '';
|
|
11
|
+
|
|
9
12
|
const base = baseUrl === '/' ? '' : baseUrl;
|
|
10
|
-
const doc =
|
|
13
|
+
const doc = path.match(/^doc:([-_a-zA-Z0-9#]*)$/);
|
|
14
|
+
|
|
11
15
|
if (doc) {
|
|
12
|
-
return `${base}/docs/${doc[1]}`;
|
|
16
|
+
return `${base}/docs/${doc[1]}${hashStr}`;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
const ref =
|
|
19
|
+
const ref = path.match(/^ref:([-_a-zA-Z0-9#]*)$/);
|
|
16
20
|
if (ref) {
|
|
17
|
-
return `${base}/reference-link/${ref[1]}`;
|
|
21
|
+
return `${base}/reference-link/${ref[1]}${hashStr}`;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
// we need to perform two matches for changelogs in case
|
|
21
25
|
// of legacy links that use 'blog' instead of 'changelog'
|
|
22
|
-
const blog =
|
|
23
|
-
const changelog =
|
|
26
|
+
const blog = path.match(/^blog:([-_a-zA-Z0-9#]*)$/);
|
|
27
|
+
const changelog = path.match(/^changelog:([-_a-zA-Z0-9#]*)$/);
|
|
24
28
|
const changelogMatch = blog || changelog;
|
|
25
29
|
if (changelogMatch) {
|
|
26
|
-
return `${base}/changelog/${changelogMatch[1]}`;
|
|
30
|
+
return `${base}/changelog/${changelogMatch[1]}${hashStr}`;
|
|
27
31
|
}
|
|
28
32
|
|
|
29
|
-
const custompage =
|
|
33
|
+
const custompage = path.match(/^page:([-_a-zA-Z0-9#]*)$/);
|
|
30
34
|
if (custompage) {
|
|
31
|
-
return `${base}/page/${custompage[1]}`;
|
|
35
|
+
return `${base}/page/${custompage[1]}${hashStr}`;
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
return href;
|
|
@@ -55,6 +55,7 @@ function Code(props) {
|
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
57
|
<React.Fragment>
|
|
58
|
+
{copyButtons && <CopyCode className="fa" codeRef={codeRef} />}
|
|
58
59
|
<code
|
|
59
60
|
ref={codeRef}
|
|
60
61
|
className={['rdmd-code', `lang-${language}`, `theme-${theme}`].join(' ')}
|
|
@@ -62,7 +63,6 @@ function Code(props) {
|
|
|
62
63
|
name={meta}
|
|
63
64
|
suppressHydrationWarning={true}
|
|
64
65
|
>
|
|
65
|
-
{copyButtons && <CopyCode className="fa" codeRef={codeRef} />}
|
|
66
66
|
{codeContent}
|
|
67
67
|
</code>
|
|
68
68
|
</React.Fragment>
|
package/dist/main.js
CHANGED
|
@@ -9094,6 +9094,8 @@ var _extends = __webpack_require__(7154);
|
|
|
9094
9094
|
|
|
9095
9095
|
var _objectWithoutProperties = __webpack_require__(6479);
|
|
9096
9096
|
|
|
9097
|
+
var _slicedToArray = __webpack_require__(3038);
|
|
9098
|
+
|
|
9097
9099
|
var _excluded = ["baseUrl", "children", "href", "target", "title"];
|
|
9098
9100
|
|
|
9099
9101
|
var React = __webpack_require__(4466);
|
|
@@ -9105,33 +9107,39 @@ var BaseUrlContext = __webpack_require__(6785); // Nabbed from here:
|
|
|
9105
9107
|
|
|
9106
9108
|
|
|
9107
9109
|
function getHref(href, baseUrl) {
|
|
9110
|
+
var _href$split = href.split('#'),
|
|
9111
|
+
_href$split2 = _slicedToArray(_href$split, 2),
|
|
9112
|
+
path = _href$split2[0],
|
|
9113
|
+
hash = _href$split2[1];
|
|
9114
|
+
|
|
9115
|
+
var hashStr = hash ? "#".concat(hash) : '';
|
|
9108
9116
|
var base = baseUrl === '/' ? '' : baseUrl;
|
|
9109
|
-
var doc =
|
|
9117
|
+
var doc = path.match(/^doc:([-_a-zA-Z0-9#]*)$/);
|
|
9110
9118
|
|
|
9111
9119
|
if (doc) {
|
|
9112
|
-
return "".concat(base, "/docs/").concat(doc[1]);
|
|
9120
|
+
return "".concat(base, "/docs/").concat(doc[1]).concat(hashStr);
|
|
9113
9121
|
}
|
|
9114
9122
|
|
|
9115
|
-
var ref =
|
|
9123
|
+
var ref = path.match(/^ref:([-_a-zA-Z0-9#]*)$/);
|
|
9116
9124
|
|
|
9117
9125
|
if (ref) {
|
|
9118
|
-
return "".concat(base, "/reference-link/").concat(ref[1]);
|
|
9126
|
+
return "".concat(base, "/reference-link/").concat(ref[1]).concat(hashStr);
|
|
9119
9127
|
} // we need to perform two matches for changelogs in case
|
|
9120
9128
|
// of legacy links that use 'blog' instead of 'changelog'
|
|
9121
9129
|
|
|
9122
9130
|
|
|
9123
|
-
var blog =
|
|
9124
|
-
var changelog =
|
|
9131
|
+
var blog = path.match(/^blog:([-_a-zA-Z0-9#]*)$/);
|
|
9132
|
+
var changelog = path.match(/^changelog:([-_a-zA-Z0-9#]*)$/);
|
|
9125
9133
|
var changelogMatch = blog || changelog;
|
|
9126
9134
|
|
|
9127
9135
|
if (changelogMatch) {
|
|
9128
|
-
return "".concat(base, "/changelog/").concat(changelogMatch[1]);
|
|
9136
|
+
return "".concat(base, "/changelog/").concat(changelogMatch[1]).concat(hashStr);
|
|
9129
9137
|
}
|
|
9130
9138
|
|
|
9131
|
-
var custompage =
|
|
9139
|
+
var custompage = path.match(/^page:([-_a-zA-Z0-9#]*)$/);
|
|
9132
9140
|
|
|
9133
9141
|
if (custompage) {
|
|
9134
|
-
return "".concat(base, "/page/").concat(custompage[1]);
|
|
9142
|
+
return "".concat(base, "/page/").concat(custompage[1]).concat(hashStr);
|
|
9135
9143
|
}
|
|
9136
9144
|
|
|
9137
9145
|
return href;
|
|
@@ -9349,16 +9357,16 @@ function Code(props) {
|
|
|
9349
9357
|
dark: theme === 'dark'
|
|
9350
9358
|
};
|
|
9351
9359
|
var codeContent = syntaxHighlighter && children ? syntaxHighlighter(children[0], language, codeOpts) : (children === null || children === void 0 ? void 0 : children[0]) || '';
|
|
9352
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
9360
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, copyButtons && /*#__PURE__*/React.createElement(CopyCode, {
|
|
9361
|
+
className: "fa",
|
|
9362
|
+
codeRef: codeRef
|
|
9363
|
+
}), /*#__PURE__*/React.createElement("code", {
|
|
9353
9364
|
ref: codeRef,
|
|
9354
9365
|
className: ['rdmd-code', "lang-".concat(language), "theme-".concat(theme)].join(' '),
|
|
9355
9366
|
"data-lang": language,
|
|
9356
9367
|
name: meta,
|
|
9357
9368
|
suppressHydrationWarning: true
|
|
9358
|
-
},
|
|
9359
|
-
className: "fa",
|
|
9360
|
-
codeRef: codeRef
|
|
9361
|
-
}), codeContent));
|
|
9369
|
+
}, codeContent));
|
|
9362
9370
|
}
|
|
9363
9371
|
|
|
9364
9372
|
function CreateCode(_ref2) {
|
|
@@ -28137,12 +28145,16 @@ var _require = __webpack_require__(7589),
|
|
|
28137
28145
|
imgSizeByWidth = _require.imgSizeByWidth;
|
|
28138
28146
|
|
|
28139
28147
|
var compileImage = function compileImage(image) {
|
|
28148
|
+
var _ref = image.data.hProperties || {},
|
|
28149
|
+
className = _ref.className,
|
|
28150
|
+
width = _ref.width;
|
|
28151
|
+
|
|
28140
28152
|
var img = _objectSpread(_objectSpread({
|
|
28141
28153
|
image: [image.url, image.title, image.alt]
|
|
28142
|
-
},
|
|
28143
|
-
sizing: imgSizeByWidth[
|
|
28144
|
-
}),
|
|
28145
|
-
border:
|
|
28154
|
+
}, width && {
|
|
28155
|
+
sizing: imgSizeByWidth[width]
|
|
28156
|
+
}), className === 'border' && {
|
|
28157
|
+
border: true
|
|
28146
28158
|
});
|
|
28147
28159
|
|
|
28148
28160
|
return img;
|
|
@@ -28230,15 +28242,21 @@ module.exports = function ImageCompiler() {
|
|
|
28230
28242
|
var originalImageCompiler = visitors.image;
|
|
28231
28243
|
|
|
28232
28244
|
visitors.image = function compile(node) {
|
|
28233
|
-
var _node$data, _node$data$hPropertie, _node$data2,
|
|
28245
|
+
var _node$data, _node$data$hPropertie, _node$data2, _visitors$figure;
|
|
28246
|
+
|
|
28247
|
+
if (((_node$data = node.data) === null || _node$data === void 0 ? void 0 : (_node$data$hPropertie = _node$data.hProperties) === null || _node$data$hPropertie === void 0 ? void 0 : _node$data$hPropertie.className) === 'emoji') return node.title; // Use magic block instead of markdown when there are certain defined properties we can't store in markdown
|
|
28248
|
+
|
|
28249
|
+
var _ref = ((_node$data2 = node.data) === null || _node$data2 === void 0 ? void 0 : _node$data2.hProperties) || {},
|
|
28250
|
+
className = _ref.className,
|
|
28251
|
+
width = _ref.width;
|
|
28234
28252
|
|
|
28235
|
-
|
|
28253
|
+
var useMagicBlock = Boolean(width) || (className === null || className === void 0 ? void 0 : className.length);
|
|
28236
28254
|
|
|
28237
28255
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
28238
28256
|
args[_key - 1] = arguments[_key];
|
|
28239
28257
|
}
|
|
28240
28258
|
|
|
28241
|
-
if (
|
|
28259
|
+
if (useMagicBlock) return (_visitors$figure = visitors.figure).call.apply(_visitors$figure, [this, node].concat(args));
|
|
28242
28260
|
return originalImageCompiler.call.apply(originalImageCompiler, [this, node].concat(args));
|
|
28243
28261
|
};
|
|
28244
28262
|
};
|
package/dist/main.node.js
CHANGED
|
@@ -9094,6 +9094,8 @@ var _extends = __webpack_require__(7154);
|
|
|
9094
9094
|
|
|
9095
9095
|
var _objectWithoutProperties = __webpack_require__(6479);
|
|
9096
9096
|
|
|
9097
|
+
var _slicedToArray = __webpack_require__(3038);
|
|
9098
|
+
|
|
9097
9099
|
var _excluded = ["baseUrl", "children", "href", "target", "title"];
|
|
9098
9100
|
|
|
9099
9101
|
var React = __webpack_require__(4466);
|
|
@@ -9105,33 +9107,39 @@ var BaseUrlContext = __webpack_require__(6785); // Nabbed from here:
|
|
|
9105
9107
|
|
|
9106
9108
|
|
|
9107
9109
|
function getHref(href, baseUrl) {
|
|
9110
|
+
var _href$split = href.split('#'),
|
|
9111
|
+
_href$split2 = _slicedToArray(_href$split, 2),
|
|
9112
|
+
path = _href$split2[0],
|
|
9113
|
+
hash = _href$split2[1];
|
|
9114
|
+
|
|
9115
|
+
var hashStr = hash ? "#".concat(hash) : '';
|
|
9108
9116
|
var base = baseUrl === '/' ? '' : baseUrl;
|
|
9109
|
-
var doc =
|
|
9117
|
+
var doc = path.match(/^doc:([-_a-zA-Z0-9#]*)$/);
|
|
9110
9118
|
|
|
9111
9119
|
if (doc) {
|
|
9112
|
-
return "".concat(base, "/docs/").concat(doc[1]);
|
|
9120
|
+
return "".concat(base, "/docs/").concat(doc[1]).concat(hashStr);
|
|
9113
9121
|
}
|
|
9114
9122
|
|
|
9115
|
-
var ref =
|
|
9123
|
+
var ref = path.match(/^ref:([-_a-zA-Z0-9#]*)$/);
|
|
9116
9124
|
|
|
9117
9125
|
if (ref) {
|
|
9118
|
-
return "".concat(base, "/reference-link/").concat(ref[1]);
|
|
9126
|
+
return "".concat(base, "/reference-link/").concat(ref[1]).concat(hashStr);
|
|
9119
9127
|
} // we need to perform two matches for changelogs in case
|
|
9120
9128
|
// of legacy links that use 'blog' instead of 'changelog'
|
|
9121
9129
|
|
|
9122
9130
|
|
|
9123
|
-
var blog =
|
|
9124
|
-
var changelog =
|
|
9131
|
+
var blog = path.match(/^blog:([-_a-zA-Z0-9#]*)$/);
|
|
9132
|
+
var changelog = path.match(/^changelog:([-_a-zA-Z0-9#]*)$/);
|
|
9125
9133
|
var changelogMatch = blog || changelog;
|
|
9126
9134
|
|
|
9127
9135
|
if (changelogMatch) {
|
|
9128
|
-
return "".concat(base, "/changelog/").concat(changelogMatch[1]);
|
|
9136
|
+
return "".concat(base, "/changelog/").concat(changelogMatch[1]).concat(hashStr);
|
|
9129
9137
|
}
|
|
9130
9138
|
|
|
9131
|
-
var custompage =
|
|
9139
|
+
var custompage = path.match(/^page:([-_a-zA-Z0-9#]*)$/);
|
|
9132
9140
|
|
|
9133
9141
|
if (custompage) {
|
|
9134
|
-
return "".concat(base, "/page/").concat(custompage[1]);
|
|
9142
|
+
return "".concat(base, "/page/").concat(custompage[1]).concat(hashStr);
|
|
9135
9143
|
}
|
|
9136
9144
|
|
|
9137
9145
|
return href;
|
|
@@ -9349,16 +9357,16 @@ function Code(props) {
|
|
|
9349
9357
|
dark: theme === 'dark'
|
|
9350
9358
|
};
|
|
9351
9359
|
var codeContent = syntaxHighlighter && children ? syntaxHighlighter(children[0], language, codeOpts) : (children === null || children === void 0 ? void 0 : children[0]) || '';
|
|
9352
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
9360
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, copyButtons && /*#__PURE__*/React.createElement(CopyCode, {
|
|
9361
|
+
className: "fa",
|
|
9362
|
+
codeRef: codeRef
|
|
9363
|
+
}), /*#__PURE__*/React.createElement("code", {
|
|
9353
9364
|
ref: codeRef,
|
|
9354
9365
|
className: ['rdmd-code', "lang-".concat(language), "theme-".concat(theme)].join(' '),
|
|
9355
9366
|
"data-lang": language,
|
|
9356
9367
|
name: meta,
|
|
9357
9368
|
suppressHydrationWarning: true
|
|
9358
|
-
},
|
|
9359
|
-
className: "fa",
|
|
9360
|
-
codeRef: codeRef
|
|
9361
|
-
}), codeContent));
|
|
9369
|
+
}, codeContent));
|
|
9362
9370
|
}
|
|
9363
9371
|
|
|
9364
9372
|
function CreateCode(_ref2) {
|
|
@@ -10959,12 +10967,16 @@ var _require = __webpack_require__(7589),
|
|
|
10959
10967
|
imgSizeByWidth = _require.imgSizeByWidth;
|
|
10960
10968
|
|
|
10961
10969
|
var compileImage = function compileImage(image) {
|
|
10970
|
+
var _ref = image.data.hProperties || {},
|
|
10971
|
+
className = _ref.className,
|
|
10972
|
+
width = _ref.width;
|
|
10973
|
+
|
|
10962
10974
|
var img = _objectSpread(_objectSpread({
|
|
10963
10975
|
image: [image.url, image.title, image.alt]
|
|
10964
|
-
},
|
|
10965
|
-
sizing: imgSizeByWidth[
|
|
10966
|
-
}),
|
|
10967
|
-
border:
|
|
10976
|
+
}, width && {
|
|
10977
|
+
sizing: imgSizeByWidth[width]
|
|
10978
|
+
}), className === 'border' && {
|
|
10979
|
+
border: true
|
|
10968
10980
|
});
|
|
10969
10981
|
|
|
10970
10982
|
return img;
|
|
@@ -11052,15 +11064,21 @@ module.exports = function ImageCompiler() {
|
|
|
11052
11064
|
var originalImageCompiler = visitors.image;
|
|
11053
11065
|
|
|
11054
11066
|
visitors.image = function compile(node) {
|
|
11055
|
-
var _node$data, _node$data$hPropertie, _node$data2,
|
|
11067
|
+
var _node$data, _node$data$hPropertie, _node$data2, _visitors$figure;
|
|
11068
|
+
|
|
11069
|
+
if (((_node$data = node.data) === null || _node$data === void 0 ? void 0 : (_node$data$hPropertie = _node$data.hProperties) === null || _node$data$hPropertie === void 0 ? void 0 : _node$data$hPropertie.className) === 'emoji') return node.title; // Use magic block instead of markdown when there are certain defined properties we can't store in markdown
|
|
11070
|
+
|
|
11071
|
+
var _ref = ((_node$data2 = node.data) === null || _node$data2 === void 0 ? void 0 : _node$data2.hProperties) || {},
|
|
11072
|
+
className = _ref.className,
|
|
11073
|
+
width = _ref.width;
|
|
11056
11074
|
|
|
11057
|
-
|
|
11075
|
+
var useMagicBlock = Boolean(width) || (className === null || className === void 0 ? void 0 : className.length);
|
|
11058
11076
|
|
|
11059
11077
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
11060
11078
|
args[_key - 1] = arguments[_key];
|
|
11061
11079
|
}
|
|
11062
11080
|
|
|
11063
|
-
if (
|
|
11081
|
+
if (useMagicBlock) return (_visitors$figure = visitors.figure).call.apply(_visitors$figure, [this, node].concat(args));
|
|
11064
11082
|
return originalImageCompiler.call.apply(originalImageCompiler, [this, node].concat(args));
|
|
11065
11083
|
};
|
|
11066
11084
|
};
|
package/package.json
CHANGED