@readme/markdown 6.75.0-beta.34 → 6.75.0-beta.36
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 +14 -25
- package/components/Callout/index.tsx +8 -8
- package/components/Glossary/index.tsx +37 -0
- package/components/Glossary/style.scss +69 -0
- package/components/index.ts +1 -1
- package/dist/components/Glossary/index.d.ts +10 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/contexts/GlossaryTerms.d.ts +0 -8
- package/dist/contexts/index.d.ts +5 -0
- package/dist/index.d.ts +15 -5
- package/dist/main.js +254 -209
- package/dist/main.node.js +191 -166
- package/dist/processor/compile/callout.d.ts +3 -0
- package/package.json +1 -1
- package/styles/components.scss +1 -1
- package/components/GlossaryItem/index.tsx +0 -31
- package/components/GlossaryItem/style.scss +0 -60
- package/dist/components/GlossaryItem/index.d.ts +0 -9
package/dist/main.node.js
CHANGED
|
@@ -6780,100 +6780,6 @@ module.exports = {
|
|
|
6780
6780
|
}));
|
|
6781
6781
|
|
|
6782
6782
|
|
|
6783
|
-
/***/ }),
|
|
6784
|
-
|
|
6785
|
-
/***/ 294:
|
|
6786
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6787
|
-
|
|
6788
|
-
const _excluded = ["baseUrl", "children", "href", "target", "title"];
|
|
6789
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6790
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6791
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6792
|
-
const PropTypes = __webpack_require__(556);
|
|
6793
|
-
const React = __webpack_require__(540);
|
|
6794
|
-
const BaseUrlContext = __webpack_require__(357);
|
|
6795
|
-
|
|
6796
|
-
// Nabbed from here:
|
|
6797
|
-
// https://github.com/readmeio/api-explorer/blob/0dedafcf71102feedaa4145040d3f57d79d95752/packages/api-explorer/src/lib/markdown/renderer.js#L52
|
|
6798
|
-
function getHref(href, baseUrl) {
|
|
6799
|
-
const [path, hash] = href.split('#');
|
|
6800
|
-
const hashStr = hash ? `#${hash}` : '';
|
|
6801
|
-
const base = baseUrl === '/' ? '' : baseUrl;
|
|
6802
|
-
const doc = path.match(/^doc:([-_a-zA-Z0-9#]*)$/);
|
|
6803
|
-
if (doc) {
|
|
6804
|
-
return `${base}/docs/${doc[1]}${hashStr}`;
|
|
6805
|
-
}
|
|
6806
|
-
const ref = path.match(/^ref:([-_a-zA-Z0-9#]*)$/);
|
|
6807
|
-
if (ref) {
|
|
6808
|
-
return `${base}/reference-link/${ref[1]}${hashStr}`;
|
|
6809
|
-
}
|
|
6810
|
-
|
|
6811
|
-
// we need to perform two matches for changelogs in case
|
|
6812
|
-
// of legacy links that use 'blog' instead of 'changelog'
|
|
6813
|
-
const blog = path.match(/^blog:([-_a-zA-Z0-9#]*)$/);
|
|
6814
|
-
const changelog = path.match(/^changelog:([-_a-zA-Z0-9#]*)$/);
|
|
6815
|
-
const changelogMatch = blog || changelog;
|
|
6816
|
-
if (changelogMatch) {
|
|
6817
|
-
return `${base}/changelog/${changelogMatch[1]}${hashStr}`;
|
|
6818
|
-
}
|
|
6819
|
-
const custompage = path.match(/^page:([-_a-zA-Z0-9#]*)$/);
|
|
6820
|
-
if (custompage) {
|
|
6821
|
-
return `${base}/page/${custompage[1]}${hashStr}`;
|
|
6822
|
-
}
|
|
6823
|
-
return href;
|
|
6824
|
-
}
|
|
6825
|
-
function docLink(href) {
|
|
6826
|
-
const doc = href.match(/^doc:([-_a-zA-Z0-9#]*)$/);
|
|
6827
|
-
if (!doc) return false;
|
|
6828
|
-
return {
|
|
6829
|
-
className: 'doc-link',
|
|
6830
|
-
'data-sidebar': doc[1]
|
|
6831
|
-
};
|
|
6832
|
-
}
|
|
6833
|
-
function Anchor(props) {
|
|
6834
|
-
const {
|
|
6835
|
-
baseUrl,
|
|
6836
|
-
children,
|
|
6837
|
-
href,
|
|
6838
|
-
target,
|
|
6839
|
-
title
|
|
6840
|
-
} = props,
|
|
6841
|
-
attrs = _objectWithoutProperties(props, _excluded);
|
|
6842
|
-
return (
|
|
6843
|
-
/*#__PURE__*/
|
|
6844
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
6845
|
-
React.createElement("a", _extends({}, attrs, {
|
|
6846
|
-
href: getHref(href, baseUrl),
|
|
6847
|
-
target: target,
|
|
6848
|
-
title: title
|
|
6849
|
-
}, docLink(href)), children)
|
|
6850
|
-
);
|
|
6851
|
-
}
|
|
6852
|
-
Anchor.propTypes = {
|
|
6853
|
-
baseUrl: PropTypes.string,
|
|
6854
|
-
children: PropTypes.node.isRequired,
|
|
6855
|
-
download: PropTypes.string,
|
|
6856
|
-
href: PropTypes.string,
|
|
6857
|
-
target: PropTypes.string,
|
|
6858
|
-
title: PropTypes.string
|
|
6859
|
-
};
|
|
6860
|
-
Anchor.defaultProps = {
|
|
6861
|
-
baseUrl: '/',
|
|
6862
|
-
href: '',
|
|
6863
|
-
target: '',
|
|
6864
|
-
title: ''
|
|
6865
|
-
};
|
|
6866
|
-
const AnchorWithContext = props => /*#__PURE__*/React.createElement(BaseUrlContext.Consumer, null, baseUrl => /*#__PURE__*/React.createElement(Anchor, _extends({
|
|
6867
|
-
baseUrl: baseUrl
|
|
6868
|
-
}, props)));
|
|
6869
|
-
AnchorWithContext.sanitize = sanitizeSchema => {
|
|
6870
|
-
// This is for our custom link formats
|
|
6871
|
-
sanitizeSchema.protocols.href.push('doc', 'target', 'ref', 'blog', 'changelog', 'page');
|
|
6872
|
-
return sanitizeSchema;
|
|
6873
|
-
};
|
|
6874
|
-
module.exports = AnchorWithContext;
|
|
6875
|
-
AnchorWithContext.getHref = getHref;
|
|
6876
|
-
|
|
6877
6783
|
/***/ }),
|
|
6878
6784
|
|
|
6879
6785
|
/***/ 398:
|
|
@@ -6977,14 +6883,6 @@ module.exports = CreateStyle;
|
|
|
6977
6883
|
|
|
6978
6884
|
/***/ }),
|
|
6979
6885
|
|
|
6980
|
-
/***/ 357:
|
|
6981
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6982
|
-
|
|
6983
|
-
const React = __webpack_require__(540);
|
|
6984
|
-
module.exports = React.createContext('/');
|
|
6985
|
-
|
|
6986
|
-
/***/ }),
|
|
6987
|
-
|
|
6988
6886
|
/***/ 965:
|
|
6989
6887
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6990
6888
|
|
|
@@ -9922,12 +9820,12 @@ __webpack_require__.d(util_types_namespaceObject, {
|
|
|
9922
9820
|
var components_namespaceObject = {};
|
|
9923
9821
|
__webpack_require__.r(components_namespaceObject);
|
|
9924
9822
|
__webpack_require__.d(components_namespaceObject, {
|
|
9925
|
-
Anchor: () => (
|
|
9823
|
+
Anchor: () => (components_Anchor),
|
|
9926
9824
|
Callout: () => (components_Callout),
|
|
9927
9825
|
Code: () => (components_Code),
|
|
9928
9826
|
CodeTabs: () => (components_CodeTabs),
|
|
9929
9827
|
Embed: () => (components_Embed),
|
|
9930
|
-
|
|
9828
|
+
Glossary: () => (GlossaryWithContext),
|
|
9931
9829
|
HTMLBlock: () => (components_HTMLBlock),
|
|
9932
9830
|
Heading: () => ((Heading_default())),
|
|
9933
9831
|
Image: () => (components_Image),
|
|
@@ -58237,9 +58135,92 @@ var jsx_runtime_namespaceObject = /*#__PURE__*/__webpack_require__.t(jsx_runtime
|
|
|
58237
58135
|
// EXTERNAL MODULE: ./node_modules/@readme/variable/dist/index.js
|
|
58238
58136
|
var dist = __webpack_require__(355);
|
|
58239
58137
|
var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
|
|
58240
|
-
// EXTERNAL MODULE: ./
|
|
58241
|
-
var
|
|
58242
|
-
|
|
58138
|
+
// EXTERNAL MODULE: ./node_modules/prop-types/index.js
|
|
58139
|
+
var prop_types = __webpack_require__(556);
|
|
58140
|
+
;// CONCATENATED MODULE: ./contexts/BaseUrl.js
|
|
58141
|
+
|
|
58142
|
+
const BaseUrlContext = /*#__PURE__*/react.createContext('/');
|
|
58143
|
+
/* harmony default export */ const BaseUrl = (BaseUrlContext);
|
|
58144
|
+
;// CONCATENATED MODULE: ./components/Anchor.jsx
|
|
58145
|
+
const _excluded = ["children", "href", "target", "title"];
|
|
58146
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
58147
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
58148
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
58149
|
+
|
|
58150
|
+
|
|
58151
|
+
|
|
58152
|
+
|
|
58153
|
+
// Nabbed from here:
|
|
58154
|
+
// https://github.com/readmeio/api-explorer/blob/0dedafcf71102feedaa4145040d3f57d79d95752/packages/api-explorer/src/lib/markdown/renderer.js#L52
|
|
58155
|
+
function getHref(href, baseUrl) {
|
|
58156
|
+
const [path, hash] = href.split('#');
|
|
58157
|
+
const hashStr = hash ? `#${hash}` : '';
|
|
58158
|
+
const base = baseUrl === '/' ? '' : baseUrl;
|
|
58159
|
+
const doc = path.match(/^doc:([-_a-zA-Z0-9#]*)$/);
|
|
58160
|
+
if (doc) {
|
|
58161
|
+
return `${base}/docs/${doc[1]}${hashStr}`;
|
|
58162
|
+
}
|
|
58163
|
+
const ref = path.match(/^ref:([-_a-zA-Z0-9#]*)$/);
|
|
58164
|
+
if (ref) {
|
|
58165
|
+
return `${base}/reference-link/${ref[1]}${hashStr}`;
|
|
58166
|
+
}
|
|
58167
|
+
|
|
58168
|
+
// we need to perform two matches for changelogs in case
|
|
58169
|
+
// of legacy links that use 'blog' instead of 'changelog'
|
|
58170
|
+
const blog = path.match(/^blog:([-_a-zA-Z0-9#]*)$/);
|
|
58171
|
+
const changelog = path.match(/^changelog:([-_a-zA-Z0-9#]*)$/);
|
|
58172
|
+
const changelogMatch = blog || changelog;
|
|
58173
|
+
if (changelogMatch) {
|
|
58174
|
+
return `${base}/changelog/${changelogMatch[1]}${hashStr}`;
|
|
58175
|
+
}
|
|
58176
|
+
const custompage = path.match(/^page:([-_a-zA-Z0-9#]*)$/);
|
|
58177
|
+
if (custompage) {
|
|
58178
|
+
return `${base}/page/${custompage[1]}${hashStr}`;
|
|
58179
|
+
}
|
|
58180
|
+
return href;
|
|
58181
|
+
}
|
|
58182
|
+
function docLink(href) {
|
|
58183
|
+
const doc = href.match(/^doc:([-_a-zA-Z0-9#]*)$/);
|
|
58184
|
+
if (!doc) return false;
|
|
58185
|
+
return {
|
|
58186
|
+
className: 'doc-link',
|
|
58187
|
+
'data-sidebar': doc[1]
|
|
58188
|
+
};
|
|
58189
|
+
}
|
|
58190
|
+
function Anchor(props) {
|
|
58191
|
+
const {
|
|
58192
|
+
children,
|
|
58193
|
+
href,
|
|
58194
|
+
target,
|
|
58195
|
+
title
|
|
58196
|
+
} = props,
|
|
58197
|
+
attrs = _objectWithoutProperties(props, _excluded);
|
|
58198
|
+
const baseUrl = useContext(BaseUrl);
|
|
58199
|
+
return (
|
|
58200
|
+
/*#__PURE__*/
|
|
58201
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
58202
|
+
react.createElement("a", _extends({}, attrs, {
|
|
58203
|
+
href: getHref(href, baseUrl),
|
|
58204
|
+
target: target,
|
|
58205
|
+
title: title
|
|
58206
|
+
}, docLink(href)), children)
|
|
58207
|
+
);
|
|
58208
|
+
}
|
|
58209
|
+
Anchor.propTypes = {
|
|
58210
|
+
baseUrl: prop_types.string,
|
|
58211
|
+
children: prop_types.node.isRequired,
|
|
58212
|
+
download: prop_types.string,
|
|
58213
|
+
href: prop_types.string,
|
|
58214
|
+
target: prop_types.string,
|
|
58215
|
+
title: prop_types.string
|
|
58216
|
+
};
|
|
58217
|
+
Anchor.defaultProps = {
|
|
58218
|
+
baseUrl: '/',
|
|
58219
|
+
href: '',
|
|
58220
|
+
target: '',
|
|
58221
|
+
title: ''
|
|
58222
|
+
};
|
|
58223
|
+
/* harmony default export */ const components_Anchor = (Anchor);
|
|
58243
58224
|
;// CONCATENATED MODULE: ./components/Callout/index.tsx
|
|
58244
58225
|
|
|
58245
58226
|
const themes = {
|
|
@@ -58257,15 +58238,17 @@ const themes = {
|
|
|
58257
58238
|
'\u26A0': 'warn',
|
|
58258
58239
|
};
|
|
58259
58240
|
const Callout = (props) => {
|
|
58260
|
-
const { attributes, children, icon
|
|
58241
|
+
const { attributes, children, icon } = props;
|
|
58261
58242
|
let theme = props.theme || themes[icon] || 'default';
|
|
58243
|
+
const [heading, ...body] = Array.isArray(children) ? children : [children];
|
|
58244
|
+
const empty = !heading.props.children;
|
|
58262
58245
|
return (
|
|
58263
58246
|
// @ts-ignore
|
|
58264
58247
|
react.createElement("blockquote", Object.assign({}, attributes, { className: `callout callout_${theme}`, theme: icon }),
|
|
58265
|
-
|
|
58248
|
+
react.createElement("h3", { className: `callout-heading${empty ? ' empty' : ''}` },
|
|
58266
58249
|
react.createElement("span", { className: "callout-icon" }, icon),
|
|
58267
|
-
heading)
|
|
58268
|
-
|
|
58250
|
+
!empty && heading),
|
|
58251
|
+
body));
|
|
58269
58252
|
};
|
|
58270
58253
|
/* harmony default export */ const components_Callout = (Callout);
|
|
58271
58254
|
|
|
@@ -62815,7 +62798,7 @@ var react_dom = __webpack_require__(961);
|
|
|
62815
62798
|
|
|
62816
62799
|
|
|
62817
62800
|
|
|
62818
|
-
function
|
|
62801
|
+
function tippy_react_esm_objectWithoutPropertiesLoose(source, excluded) {
|
|
62819
62802
|
if (source == null) return {};
|
|
62820
62803
|
var target = {};
|
|
62821
62804
|
var sourceKeys = Object.keys(source);
|
|
@@ -62977,7 +62960,7 @@ function TippyGenerator(tippy) {
|
|
|
62977
62960
|
ignoreAttributes = _ref$ignoreAttributes === void 0 ? true : _ref$ignoreAttributes,
|
|
62978
62961
|
__source = _ref.__source,
|
|
62979
62962
|
__self = _ref.__self,
|
|
62980
|
-
restOfNativeProps =
|
|
62963
|
+
restOfNativeProps = tippy_react_esm_objectWithoutPropertiesLoose(_ref, ["children", "content", "visible", "singleton", "render", "reference", "disabled", "ignoreAttributes", "__source", "__self"]);
|
|
62981
62964
|
|
|
62982
62965
|
var isControlledMode = visible !== undefined;
|
|
62983
62966
|
var isSingletonMode = singleton !== undefined;
|
|
@@ -63241,7 +63224,7 @@ function useSingletonGenerator(createSingleton) {
|
|
|
63241
63224
|
|
|
63242
63225
|
var _sourceData$props = sourceData.props,
|
|
63243
63226
|
content = _sourceData$props.content,
|
|
63244
|
-
props =
|
|
63227
|
+
props = tippy_react_esm_objectWithoutPropertiesLoose(_sourceData$props, ["content"]);
|
|
63245
63228
|
|
|
63246
63229
|
instance.setProps(deepPreserveProps(instance.props, Object.assign({}, props, {
|
|
63247
63230
|
overrides: overrides
|
|
@@ -63307,7 +63290,7 @@ function useSingletonGenerator(createSingleton) {
|
|
|
63307
63290
|
var forwardRef = (function (Tippy, defaultProps) {
|
|
63308
63291
|
return /*#__PURE__*/(0,react.forwardRef)(function TippyWrapper(_ref, _ref2) {
|
|
63309
63292
|
var children = _ref.children,
|
|
63310
|
-
props =
|
|
63293
|
+
props = tippy_react_esm_objectWithoutPropertiesLoose(_ref, ["children"]);
|
|
63311
63294
|
|
|
63312
63295
|
return (
|
|
63313
63296
|
/*#__PURE__*/
|
|
@@ -63334,28 +63317,25 @@ var tippy_react_esm_index = /*#__PURE__*/forwardRef( /*#__PURE__*/TippyGenerator
|
|
|
63334
63317
|
|
|
63335
63318
|
const GlossaryContext = (0,react.createContext)([]);
|
|
63336
63319
|
/* harmony default export */ const GlossaryTerms = (GlossaryContext);
|
|
63337
|
-
// haxx
|
|
63338
|
-
function Provider(Provider, arg1) {
|
|
63339
|
-
throw new Error('Function not implemented.');
|
|
63340
|
-
}
|
|
63341
63320
|
|
|
63342
|
-
;// CONCATENATED MODULE: ./components/
|
|
63321
|
+
;// CONCATENATED MODULE: ./components/Glossary/index.tsx
|
|
63343
63322
|
|
|
63344
63323
|
|
|
63345
63324
|
|
|
63346
|
-
const
|
|
63347
|
-
const
|
|
63325
|
+
const Glossary = ({ children, term: termProp, terms }) => {
|
|
63326
|
+
const term = (Array.isArray(children) ? children[0] : children) || termProp;
|
|
63327
|
+
const foundTerm = terms.find(i => { var _a; return term.toLowerCase() === ((_a = i === null || i === void 0 ? void 0 : i.term) === null || _a === void 0 ? void 0 : _a.toLowerCase()); });
|
|
63348
63328
|
if (!foundTerm)
|
|
63349
63329
|
return react.createElement("span", null, term);
|
|
63350
|
-
return (react.createElement(tippy_react_esm, { content: react.createElement("div", { className: "
|
|
63351
|
-
react.createElement("strong", { className: "
|
|
63330
|
+
return (react.createElement(tippy_react_esm, { content: react.createElement("div", { className: "Glossary-tooltip-content" },
|
|
63331
|
+
react.createElement("strong", { className: "Glossary-term" }, foundTerm.term),
|
|
63352
63332
|
" - ",
|
|
63353
63333
|
foundTerm.definition), offset: [-5, 5], placement: "bottom-start" },
|
|
63354
|
-
react.createElement("span", { className: "
|
|
63334
|
+
react.createElement("span", { className: "Glossary-trigger" }, term)));
|
|
63355
63335
|
};
|
|
63356
|
-
const
|
|
63336
|
+
const GlossaryWithContext = props => {
|
|
63357
63337
|
const terms = (0,react.useContext)(GlossaryTerms);
|
|
63358
|
-
return terms ? react.createElement(
|
|
63338
|
+
return terms ? react.createElement(Glossary, Object.assign({}, props, { terms: terms })) : react.createElement("span", null, props.term);
|
|
63359
63339
|
};
|
|
63360
63340
|
|
|
63361
63341
|
|
|
@@ -63450,8 +63430,6 @@ const Table = (props) => {
|
|
|
63450
63430
|
};
|
|
63451
63431
|
/* harmony default export */ const components_Table = (Table);
|
|
63452
63432
|
|
|
63453
|
-
// EXTERNAL MODULE: ./node_modules/prop-types/index.js
|
|
63454
|
-
var prop_types = __webpack_require__(556);
|
|
63455
63433
|
;// CONCATENATED MODULE: ./components/TableOfContents/index.jsx
|
|
63456
63434
|
|
|
63457
63435
|
|
|
@@ -63487,9 +63465,6 @@ TableOfContents.propTypes = {
|
|
|
63487
63465
|
|
|
63488
63466
|
|
|
63489
63467
|
|
|
63490
|
-
// EXTERNAL MODULE: ./contexts/BaseUrl.js
|
|
63491
|
-
var BaseUrl = __webpack_require__(357);
|
|
63492
|
-
var BaseUrl_default = /*#__PURE__*/__webpack_require__.n(BaseUrl);
|
|
63493
63468
|
;// CONCATENATED MODULE: ./options.js
|
|
63494
63469
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
63495
63470
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -63591,26 +63566,20 @@ const callouts_regex = `^(${emoji_regex().source}|⚠)(\\s+|$)`;
|
|
|
63591
63566
|
const calloutTransformer = () => {
|
|
63592
63567
|
return (tree) => {
|
|
63593
63568
|
visit(tree, 'blockquote', (node) => {
|
|
63594
|
-
|
|
63595
|
-
|
|
63596
|
-
|
|
63597
|
-
|
|
63598
|
-
|
|
63599
|
-
|
|
63600
|
-
|
|
63601
|
-
|
|
63602
|
-
|
|
63603
|
-
|
|
63604
|
-
|
|
63605
|
-
|
|
63606
|
-
|
|
63607
|
-
|
|
63608
|
-
},
|
|
63609
|
-
};
|
|
63610
|
-
}
|
|
63611
|
-
}
|
|
63612
|
-
catch (e) {
|
|
63613
|
-
console.log(e);
|
|
63569
|
+
if (!(node.children[0].type === 'paragraph' && node.children[0].children[0].type === 'text'))
|
|
63570
|
+
return;
|
|
63571
|
+
const startText = node.children[0].children[0].value;
|
|
63572
|
+
const [match, icon] = startText.match(callouts_regex) || [];
|
|
63573
|
+
if (icon && match) {
|
|
63574
|
+
const heading = startText.slice(match.length);
|
|
63575
|
+
node.children[0].children[0].value = heading;
|
|
63576
|
+
node.type = NodeTypes.callout;
|
|
63577
|
+
node.data = {
|
|
63578
|
+
hName: 'Callout',
|
|
63579
|
+
hProperties: {
|
|
63580
|
+
icon,
|
|
63581
|
+
},
|
|
63582
|
+
};
|
|
63614
63583
|
}
|
|
63615
63584
|
});
|
|
63616
63585
|
};
|
|
@@ -80675,10 +80644,12 @@ const gemojiTransformer = () => (tree) => {
|
|
|
80675
80644
|
|
|
80676
80645
|
;// CONCATENATED MODULE: ./processor/transform/readme-components.ts
|
|
80677
80646
|
|
|
80647
|
+
|
|
80648
|
+
|
|
80678
80649
|
const readme_components_types = {
|
|
80679
|
-
Callout: '
|
|
80650
|
+
Callout: NodeTypes['callout'],
|
|
80680
80651
|
Code: 'code',
|
|
80681
|
-
CodeTabs: '
|
|
80652
|
+
CodeTabs: NodeTypes['codeTabs'],
|
|
80682
80653
|
Image: 'image',
|
|
80683
80654
|
Table: 'table',
|
|
80684
80655
|
tr: 'tableRow',
|
|
@@ -80691,6 +80662,7 @@ const attributes = (jsx) => jsx.attributes.reduce((memo, attr) => {
|
|
|
80691
80662
|
return memo;
|
|
80692
80663
|
}, {});
|
|
80693
80664
|
const coerceJsxToMd = ({ components = {} } = {}) => (node, index, parent) => {
|
|
80665
|
+
var _a;
|
|
80694
80666
|
if (node.name in components)
|
|
80695
80667
|
return;
|
|
80696
80668
|
if (node.name === 'Code') {
|
|
@@ -80732,6 +80704,21 @@ const coerceJsxToMd = ({ components = {} } = {}) => (node, index, parent) => {
|
|
|
80732
80704
|
};
|
|
80733
80705
|
parent.children[index] = mdNode;
|
|
80734
80706
|
}
|
|
80707
|
+
else if (node.name === 'Callout') {
|
|
80708
|
+
const { heading, icon } = attributes(node);
|
|
80709
|
+
const child = mdast(heading);
|
|
80710
|
+
// @ts-ignore
|
|
80711
|
+
const mdNode = {
|
|
80712
|
+
children: [(_a = child === null || child === void 0 ? void 0 : child.children) === null || _a === void 0 ? void 0 : _a[0], ...node.children].filter(Boolean),
|
|
80713
|
+
type: NodeTypes.callout,
|
|
80714
|
+
data: {
|
|
80715
|
+
hName: node.name,
|
|
80716
|
+
hProperties: { icon },
|
|
80717
|
+
},
|
|
80718
|
+
position: node.position,
|
|
80719
|
+
};
|
|
80720
|
+
parent.children[index] = mdNode;
|
|
80721
|
+
}
|
|
80735
80722
|
else if (node.name in readme_components_types) {
|
|
80736
80723
|
const hProperties = attributes(node);
|
|
80737
80724
|
// @ts-ignore
|
|
@@ -80769,9 +80756,29 @@ const readmeComponents = (opts) => () => tree => {
|
|
|
80769
80756
|
|
|
80770
80757
|
/* harmony default export */ const transform = ([callouts, code_tabs, transform_embeds, gemoji_]);
|
|
80771
80758
|
|
|
80772
|
-
;// CONCATENATED MODULE: ./processor/compile/
|
|
80773
|
-
|
|
80774
|
-
|
|
80759
|
+
;// CONCATENATED MODULE: ./processor/compile/callout.ts
|
|
80760
|
+
|
|
80761
|
+
const callout = (node, _, state, info) => {
|
|
80762
|
+
const tracker = state.createTracker(info);
|
|
80763
|
+
const exit = state.enter(NodeTypes.callout);
|
|
80764
|
+
state.join.push(() => 0);
|
|
80765
|
+
const value = state.containerFlow(node, tracker.current());
|
|
80766
|
+
state.join.pop();
|
|
80767
|
+
exit();
|
|
80768
|
+
let lines = value.split('\n');
|
|
80769
|
+
if (lines.length > 1) {
|
|
80770
|
+
const [first, ...rest] = lines;
|
|
80771
|
+
lines = [first, '', ...rest];
|
|
80772
|
+
}
|
|
80773
|
+
let content = lines
|
|
80774
|
+
.map((line, index) => (index > 0 ? `>${line.length > 0 ? ' ' : ''}${line}` : line))
|
|
80775
|
+
.join('\n');
|
|
80776
|
+
if (content.match(/^[^\n]/))
|
|
80777
|
+
content = ' ' + content;
|
|
80778
|
+
const block = `> ${node.data.hProperties.icon}${content}`;
|
|
80779
|
+
return block;
|
|
80780
|
+
};
|
|
80781
|
+
/* harmony default export */ const compile_callout = (callout);
|
|
80775
80782
|
|
|
80776
80783
|
;// CONCATENATED MODULE: ./processor/compile/code-tabs.ts
|
|
80777
80784
|
|
|
@@ -80797,6 +80804,10 @@ const embed_embed = (node) => {
|
|
|
80797
80804
|
};
|
|
80798
80805
|
/* harmony default export */ const compile_embed = (embed_embed);
|
|
80799
80806
|
|
|
80807
|
+
;// CONCATENATED MODULE: ./processor/compile/gemoji.ts
|
|
80808
|
+
const gemoji_gemoji = (node) => `:${node.name}:`;
|
|
80809
|
+
/* harmony default export */ const compile_gemoji = (gemoji_gemoji);
|
|
80810
|
+
|
|
80800
80811
|
;// CONCATENATED MODULE: ./processor/compile/html-block.ts
|
|
80801
80812
|
const htmlBlock = (node) => {
|
|
80802
80813
|
const html = node.data.hProperties.html;
|
|
@@ -80822,10 +80833,12 @@ const compile_image_image = (node) => {
|
|
|
80822
80833
|
|
|
80823
80834
|
|
|
80824
80835
|
|
|
80836
|
+
|
|
80825
80837
|
function compilers() {
|
|
80826
80838
|
const data = this.data();
|
|
80827
80839
|
const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
|
|
80828
80840
|
const handlers = {
|
|
80841
|
+
[NodeTypes.callout]: compile_callout,
|
|
80829
80842
|
[NodeTypes.emoji]: compile_gemoji,
|
|
80830
80843
|
[NodeTypes.codeTabs]: compile_code_tabs,
|
|
80831
80844
|
[NodeTypes.embed]: compile_embed,
|
|
@@ -80834,7 +80847,6 @@ function compilers() {
|
|
|
80834
80847
|
};
|
|
80835
80848
|
toMarkdownExtensions.push({ extensions: [{ handlers }] });
|
|
80836
80849
|
}
|
|
80837
|
-
;
|
|
80838
80850
|
/* harmony default export */ const processor_compile = (compilers);
|
|
80839
80851
|
|
|
80840
80852
|
;// CONCATENATED MODULE: ./errors/mdx-syntax-error.ts
|
|
@@ -80857,6 +80869,21 @@ class MdxSyntaxError extends SyntaxError {
|
|
|
80857
80869
|
}
|
|
80858
80870
|
}
|
|
80859
80871
|
|
|
80872
|
+
;// CONCATENATED MODULE: ./contexts/index.tsx
|
|
80873
|
+
|
|
80874
|
+
|
|
80875
|
+
|
|
80876
|
+
|
|
80877
|
+
const compose = (children, ...contexts) => {
|
|
80878
|
+
return contexts.reduce((content, [Context, value]) => {
|
|
80879
|
+
return react.createElement(Context.Provider, { value: value }, content);
|
|
80880
|
+
}, children);
|
|
80881
|
+
};
|
|
80882
|
+
const Contexts = ({ children, terms = [], variables = { user: { keys: [] }, defaults: [] }, baseUrl = '/' }) => {
|
|
80883
|
+
return compose(children, [GlossaryTerms, terms], [dist.VariablesContext, variables], [BaseUrl, baseUrl]);
|
|
80884
|
+
};
|
|
80885
|
+
/* harmony default export */ const contexts = (Contexts);
|
|
80886
|
+
|
|
80860
80887
|
;// CONCATENATED MODULE: ./index.tsx
|
|
80861
80888
|
var index_rest = (undefined && undefined.__rest) || function (s, e) {
|
|
80862
80889
|
var t = {};
|
|
@@ -80886,17 +80913,13 @@ var index_rest = (undefined && undefined.__rest) || function (s, e) {
|
|
|
80886
80913
|
|
|
80887
80914
|
|
|
80888
80915
|
|
|
80889
|
-
|
|
80890
80916
|
const unimplemented = src_default()('mdx:unimplemented');
|
|
80891
80917
|
|
|
80892
80918
|
const utils = {
|
|
80893
80919
|
get options() {
|
|
80894
80920
|
return Object.assign({}, options);
|
|
80895
80921
|
},
|
|
80896
|
-
|
|
80897
|
-
getHref: Anchor.getHref,
|
|
80898
|
-
GlossaryContext: GlossaryTerms,
|
|
80899
|
-
VariablesContext: (dist_default()).VariablesContext,
|
|
80922
|
+
getHref: getHref,
|
|
80900
80923
|
calloutIcons: {},
|
|
80901
80924
|
};
|
|
80902
80925
|
const makeUseMDXComponents = (more) => {
|
|
@@ -80909,7 +80932,7 @@ const reactProcessor = (opts = {}) => {
|
|
|
80909
80932
|
};
|
|
80910
80933
|
const index_compile = (text, opts = {}) => {
|
|
80911
80934
|
try {
|
|
80912
|
-
return String(compileSync(text, Object.assign({ outputFormat: 'function-body', providerImportSource: '#', remarkPlugins }, opts))).replace(/await import\(_resolveDynamicMdxSpecifier\('react'\)\)/, 'arguments[0].imports.React');
|
|
80935
|
+
return String(compileSync(text, Object.assign({ outputFormat: 'function-body', providerImportSource: '#', remarkPlugins }, opts))).replace(/await import\(_resolveDynamicMdxSpecifier\(('react'|"react")\)\)/, 'arguments[0].imports.React');
|
|
80913
80936
|
}
|
|
80914
80937
|
catch (error) {
|
|
80915
80938
|
console.error(error);
|
|
@@ -80918,9 +80941,11 @@ const index_compile = (text, opts = {}) => {
|
|
|
80918
80941
|
};
|
|
80919
80942
|
const index_run = async (code, _opts = {}) => {
|
|
80920
80943
|
const { Fragment } = jsx_runtime_namespaceObject;
|
|
80921
|
-
const { components } = _opts, opts = index_rest(_opts, ["components"]);
|
|
80944
|
+
const { components, terms, variables, baseUrl } = _opts, opts = index_rest(_opts, ["components", "terms", "variables", "baseUrl"]);
|
|
80922
80945
|
const file = await run(code, Object.assign(Object.assign(Object.assign({}, jsx_runtime_namespaceObject), { Fragment, baseUrl: "file:///home/runner/work/markdown/markdown/index.tsx", imports: { React: react }, useMDXComponents: makeUseMDXComponents(components) }), opts));
|
|
80923
|
-
|
|
80946
|
+
const Content = (file === null || file === void 0 ? void 0 : file.default) || (() => null);
|
|
80947
|
+
return () => (react.createElement(contexts, { terms: terms, variables: variables, baseUrl: baseUrl },
|
|
80948
|
+
react.createElement(Content, null)));
|
|
80924
80949
|
};
|
|
80925
80950
|
const reactTOC = (text, opts = {}) => {
|
|
80926
80951
|
unimplemented('reactTOC');
|
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.36",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|
package/styles/components.scss
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import Tooltip from '@tippyjs/react';
|
|
3
|
-
import GlossaryContext from '../../contexts/GlossaryTerms';
|
|
4
|
-
import type { GlossaryItem, GlossaryTerm } from '../../contexts/GlossaryTerms';
|
|
5
|
-
|
|
6
|
-
const GlossaryItem = ({ term, terms }: { term: string; terms: GlossaryTerm[] }) => {
|
|
7
|
-
const foundTerm = terms.find(i => term.toLowerCase() === i.term.toLowerCase());
|
|
8
|
-
|
|
9
|
-
if (!foundTerm) return <span>{term}</span>;
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Tooltip
|
|
13
|
-
content={
|
|
14
|
-
<div className="GlossaryItem-tooltip-content">
|
|
15
|
-
<strong className="GlossaryItem-term">{foundTerm.term}</strong> - {foundTerm.definition}
|
|
16
|
-
</div>
|
|
17
|
-
}
|
|
18
|
-
offset={[-5, 5]}
|
|
19
|
-
placement="bottom-start"
|
|
20
|
-
>
|
|
21
|
-
<span className="GlossaryItem-trigger">{term}</span>
|
|
22
|
-
</Tooltip>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const GlossaryItemWithContext = props => {
|
|
27
|
-
const terms = useContext(GlossaryContext);
|
|
28
|
-
return terms ? <GlossaryItem {...props} terms={terms} /> : null;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export { GlossaryItem, GlossaryItemWithContext as default, GlossaryContext };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
.GlossaryItem {
|
|
2
|
-
&-trigger {
|
|
3
|
-
border-bottom: 1px solid #737c83;
|
|
4
|
-
border-style: dotted;
|
|
5
|
-
border-top: none;
|
|
6
|
-
border-left: none;
|
|
7
|
-
border-right: none;
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
&-tooltip-content {
|
|
12
|
-
--GlossaryItem-bg: var(--color-bg-page, var(--white));
|
|
13
|
-
--GlossaryItem-color: var(--color-text-default, var(--gray20));
|
|
14
|
-
--GlossaryItem-shadow: var(--box-shadow-menu-light, 0 5px 10px rgba(0, 0, 0, .05),
|
|
15
|
-
0 2px 6px rgba(0, 0, 0, .025),
|
|
16
|
-
0 1px 3px rgba(0, 0, 0, .025));
|
|
17
|
-
|
|
18
|
-
/* what the dark-mode mixin does in the readme project */
|
|
19
|
-
[data-color-mode='dark'] & {
|
|
20
|
-
--GlossaryItem-bg: var(--gray15);
|
|
21
|
-
--GlossaryItem-color: var(--color-text-default, var(--white));
|
|
22
|
-
--GlossaryItem-shadow: var(--box-shadow-menu-dark, 0 1px 3px rgba(0, 0, 0, 0.025),
|
|
23
|
-
0 2px 6px rgba(0, 0, 0, 0.025),
|
|
24
|
-
0 5px 10px rgba(0, 0, 0, 0.05))
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@media (prefers-color-scheme: dark) {
|
|
28
|
-
[data-color-mode='auto'] & {
|
|
29
|
-
--GlossaryItem-bg: var(--Tooltip-bg, var(--gray0));
|
|
30
|
-
--GlossaryItem-color: var(--color-text-default, var(--white));
|
|
31
|
-
--GlossaryItem-shadow: var(--box-shadow-menu-dark, 0 1px 3px rgba(0, 0, 0, 0.025),
|
|
32
|
-
0 2px 6px rgba(0, 0, 0, 0.025),
|
|
33
|
-
0 5px 10px rgba(0, 0, 0, 0.05))
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
background-color: var(--GlossaryItem-bg);
|
|
38
|
-
border: 1px solid #{var(--color-border-default, rgba(black, 0.1))};
|
|
39
|
-
border-radius: var(--border-radius);
|
|
40
|
-
box-shadow: var(--GlossaryItem-shadow);
|
|
41
|
-
color: var(--GlossaryItem-color);
|
|
42
|
-
font-size: 15px;
|
|
43
|
-
font-weight: 400;
|
|
44
|
-
line-height: 1.5;
|
|
45
|
-
padding: 15px;
|
|
46
|
-
text-align: left;
|
|
47
|
-
width: 350px;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&-term {
|
|
51
|
-
font-style: italic;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.tippy-box {
|
|
56
|
-
// needed for tippy's default animation
|
|
57
|
-
&[data-animation='fade'][data-state='hidden'] {
|
|
58
|
-
opacity: 0;
|
|
59
|
-
}
|
|
60
|
-
}
|