@readme/markdown 6.75.0-beta.35 → 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.
@@ -1,11 +1,11 @@
1
- const PropTypes = require('prop-types');
2
- const React = require('react');
1
+ import { string, node } from 'prop-types';
2
+ import React from 'react';
3
3
 
4
- const BaseUrlContext = require('../contexts/BaseUrl');
4
+ import BaseUrlContext from '../contexts/BaseUrl';
5
5
 
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
- function getHref(href, baseUrl) {
8
+ export function getHref(href, baseUrl) {
9
9
  const [path, hash] = href.split('#');
10
10
  const hashStr = hash ? `#${hash}` : '';
11
11
 
@@ -49,7 +49,9 @@ function docLink(href) {
49
49
  }
50
50
 
51
51
  function Anchor(props) {
52
- const { baseUrl, children, href, target, title, ...attrs } = props;
52
+ const { children, href, target, title, ...attrs } = props;
53
+ const baseUrl = useContext(BaseUrlContext);
54
+
53
55
  return (
54
56
  // eslint-disable-next-line react/jsx-props-no-spreading
55
57
  <a {...attrs} href={getHref(href, baseUrl)} target={target} title={title} {...docLink(href)}>
@@ -59,12 +61,12 @@ function Anchor(props) {
59
61
  }
60
62
 
61
63
  Anchor.propTypes = {
62
- baseUrl: PropTypes.string,
63
- children: PropTypes.node.isRequired,
64
- download: PropTypes.string,
65
- href: PropTypes.string,
66
- target: PropTypes.string,
67
- title: PropTypes.string,
64
+ baseUrl: string,
65
+ children: node.isRequired,
66
+ download: string,
67
+ href: string,
68
+ target: string,
69
+ title: string,
68
70
  };
69
71
 
70
72
  Anchor.defaultProps = {
@@ -74,17 +76,4 @@ Anchor.defaultProps = {
74
76
  title: '',
75
77
  };
76
78
 
77
- const AnchorWithContext = props => (
78
- <BaseUrlContext.Consumer>{baseUrl => <Anchor baseUrl={baseUrl} {...props} />}</BaseUrlContext.Consumer>
79
- );
80
-
81
- AnchorWithContext.sanitize = sanitizeSchema => {
82
- // This is for our custom link formats
83
- sanitizeSchema.protocols.href.push('doc', 'target', 'ref', 'blog', 'changelog', 'page');
84
-
85
- return sanitizeSchema;
86
- };
87
-
88
- module.exports = AnchorWithContext;
89
-
90
- AnchorWithContext.getHref = getHref;
79
+ export default Anchor;
@@ -0,0 +1,37 @@
1
+ import React, { useContext } from 'react';
2
+ import Tooltip from '@tippyjs/react';
3
+ import GlossaryContext from '../../contexts/GlossaryTerms';
4
+ import type { GlossaryTerm } from '../../contexts/GlossaryTerms';
5
+
6
+ interface Props extends React.PropsWithChildren {
7
+ term?: string;
8
+ terms: GlossaryTerm[];
9
+ }
10
+
11
+ const Glossary = ({ children, term: termProp, terms }: Props) => {
12
+ const term = (Array.isArray(children) ? children[0] : children) || termProp;
13
+ const foundTerm = terms.find(i => term.toLowerCase() === i?.term?.toLowerCase());
14
+
15
+ if (!foundTerm) return <span>{term}</span>;
16
+
17
+ return (
18
+ <Tooltip
19
+ content={
20
+ <div className="Glossary-tooltip-content">
21
+ <strong className="Glossary-term">{foundTerm.term}</strong> - {foundTerm.definition}
22
+ </div>
23
+ }
24
+ offset={[-5, 5]}
25
+ placement="bottom-start"
26
+ >
27
+ <span className="Glossary-trigger">{term}</span>
28
+ </Tooltip>
29
+ );
30
+ };
31
+
32
+ const GlossaryWithContext = props => {
33
+ const terms = useContext(GlossaryContext);
34
+ return terms ? <Glossary {...props} terms={terms} /> : <span>{props.term}</span>;
35
+ };
36
+
37
+ export { Glossary, GlossaryWithContext as default, GlossaryContext };
@@ -0,0 +1,69 @@
1
+ .Glossary {
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
+ --Glossary-bg: var(--color-bg-page, var(--white));
13
+ --Glossary-color: var(--color-text-default, var(--gray20));
14
+ --Glossary-shadow: var(
15
+ --box-shadow-menu-light,
16
+ 0 5px 10px rgba(0, 0, 0, 0.05),
17
+ 0 2px 6px rgba(0, 0, 0, 0.025),
18
+ 0 1px 3px rgba(0, 0, 0, 0.025)
19
+ );
20
+
21
+ /* what the dark-mode mixin does in the readme project */
22
+ [data-color-mode='dark'] & {
23
+ --Glossary-bg: var(--gray15);
24
+ --Glossary-color: var(--color-text-default, var(--white));
25
+ --Glossary-shadow: var(
26
+ --box-shadow-menu-dark,
27
+ 0 1px 3px rgba(0, 0, 0, 0.025),
28
+ 0 2px 6px rgba(0, 0, 0, 0.025),
29
+ 0 5px 10px rgba(0, 0, 0, 0.05)
30
+ );
31
+ }
32
+
33
+ @media (prefers-color-scheme: dark) {
34
+ [data-color-mode='auto'] & {
35
+ --Glossary-bg: var(--Tooltip-bg, var(--gray0));
36
+ --Glossary-color: var(--color-text-default, var(--white));
37
+ --Glossary-shadow: var(
38
+ --box-shadow-menu-dark,
39
+ 0 1px 3px rgba(0, 0, 0, 0.025),
40
+ 0 2px 6px rgba(0, 0, 0, 0.025),
41
+ 0 5px 10px rgba(0, 0, 0, 0.05)
42
+ );
43
+ }
44
+ }
45
+
46
+ background-color: var(--Glossary-bg);
47
+ border: 1px solid #{var(--color-border-default, rgba(black, 0.1))};
48
+ border-radius: var(--border-radius);
49
+ box-shadow: var(--Glossary-shadow);
50
+ color: var(--Glossary-color);
51
+ font-size: 15px;
52
+ font-weight: 400;
53
+ line-height: 1.5;
54
+ padding: 15px;
55
+ text-align: left;
56
+ width: 350px;
57
+ }
58
+
59
+ &-term {
60
+ font-style: italic;
61
+ }
62
+ }
63
+
64
+ .tippy-box {
65
+ // needed for tippy's default animation
66
+ &[data-animation='fade'][data-state='hidden'] {
67
+ opacity: 0;
68
+ }
69
+ }
@@ -3,7 +3,7 @@ export { default as Callout } from './Callout';
3
3
  export { default as Code } from './Code';
4
4
  export { default as CodeTabs } from './CodeTabs';
5
5
  export { default as Embed } from './Embed';
6
- export { default as GlossaryItem } from './GlossaryItem';
6
+ export { default as Glossary } from './Glossary';
7
7
  export { default as HTMLBlock } from './HTMLBlock';
8
8
  export { default as Heading } from './Heading';
9
9
  export { default as Image } from './Image';
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import GlossaryContext from '../../contexts/GlossaryTerms';
3
+ import type { GlossaryTerm } from '../../contexts/GlossaryTerms';
4
+ interface Props extends React.PropsWithChildren {
5
+ term?: string;
6
+ terms: GlossaryTerm[];
7
+ }
8
+ declare const Glossary: ({ children, term: termProp, terms }: Props) => React.JSX.Element;
9
+ declare const GlossaryWithContext: (props: any) => React.JSX.Element;
10
+ export { Glossary, GlossaryWithContext as default, GlossaryContext };
@@ -3,7 +3,7 @@ export { default as Callout } from './Callout';
3
3
  export { default as Code } from './Code';
4
4
  export { default as CodeTabs } from './CodeTabs';
5
5
  export { default as Embed } from './Embed';
6
- export { default as GlossaryItem } from './GlossaryItem';
6
+ export { default as Glossary } from './Glossary';
7
7
  export { default as HTMLBlock } from './HTMLBlock';
8
8
  export { default as Heading } from './Heading';
9
9
  export { default as Image } from './Image';
@@ -1,15 +1,7 @@
1
- import { ReactNode } from "react";
2
1
  export type GlossaryTerm = {
3
2
  term: string;
4
3
  definition: string;
5
4
  _id?: string;
6
5
  };
7
- export type GlossaryItem = {
8
- term?: string;
9
- terms: GlossaryTerm[];
10
- };
11
6
  declare const GlossaryContext: import("react").Context<GlossaryTerm[]>;
12
7
  export default GlossaryContext;
13
- export declare function Provider(Provider: any, arg1: {
14
- value: GlossaryTerm[];
15
- }): ReactNode;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { RunOpts } from '../index';
3
+ type Props = React.PropsWithChildren & Pick<RunOpts, 'baseUrl' | 'terms' | 'variables'>;
4
+ declare const Contexts: ({ children, terms, variables, baseUrl }: Props) => React.ReactNode;
5
+ export default Contexts;
package/dist/index.d.ts CHANGED
@@ -1,23 +1,33 @@
1
1
  import React from 'react';
2
2
  import { RunOptions } from '@mdx-js/mdx';
3
3
  import * as Components from './components';
4
+ import { GlossaryTerm } from './contexts/GlossaryTerms';
4
5
  type ComponentOpts = Record<string, (props: any) => React.ReactNode>;
5
- type RunOpts = Omit<RunOptions, 'Fragment'> & {
6
+ interface Variables {
7
+ user: {
8
+ keys: string[];
9
+ };
10
+ defaults: {
11
+ name: string;
12
+ default: string;
13
+ }[];
14
+ }
15
+ export type RunOpts = Omit<RunOptions, 'Fragment'> & {
6
16
  components?: ComponentOpts;
7
17
  imports?: Record<string, unknown>;
18
+ baseUrl?: string;
19
+ terms?: GlossaryTerm[];
20
+ variables?: Variables;
8
21
  };
9
22
  export { Components };
10
23
  export declare const utils: {
11
24
  readonly options: any;
12
- BaseUrlContext: any;
13
25
  getHref: any;
14
- GlossaryContext: React.Context<import("./contexts/GlossaryTerms").GlossaryTerm[]>;
15
- VariablesContext: any;
16
26
  calloutIcons: {};
17
27
  };
18
28
  export declare const reactProcessor: (opts?: {}) => import("unified").Processor<import("mdast").Root, import("estree").Program, import("estree").Program, import("estree").Program, string>;
19
29
  export declare const compile: (text: string, opts?: {}) => string;
20
- export declare const run: (code: string, _opts?: RunOpts) => Promise<import("mdx/types").MDXContent | (() => any)>;
30
+ export declare const run: (code: string, _opts?: RunOpts) => Promise<() => React.JSX.Element>;
21
31
  export declare const reactTOC: (text: string, opts?: {}) => void;
22
32
  export declare const mdx: (tree: any, opts?: {}) => string;
23
33
  export declare const html: (text: string, opts?: {}) => void;
package/dist/main.js CHANGED
@@ -6783,131 +6783,6 @@ module.exports = {
6783
6783
  }));
6784
6784
 
6785
6785
 
6786
- /***/ }),
6787
-
6788
- /***/ 9294:
6789
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6790
-
6791
- __webpack_require__(3534);
6792
- __webpack_require__(590);
6793
- __webpack_require__(4216);
6794
- __webpack_require__(5195);
6795
- __webpack_require__(9693);
6796
- __webpack_require__(8665);
6797
- __webpack_require__(4913);
6798
- __webpack_require__(9389);
6799
- __webpack_require__(4189);
6800
- __webpack_require__(8741);
6801
- __webpack_require__(9218);
6802
- __webpack_require__(7899);
6803
- __webpack_require__(5086);
6804
- __webpack_require__(6048);
6805
- __webpack_require__(9979);
6806
- __webpack_require__(4602);
6807
- var _excluded = ["baseUrl", "children", "href", "target", "title"];
6808
- 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); }
6809
- 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; }
6810
- 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; }
6811
- __webpack_require__(115);
6812
- __webpack_require__(4895);
6813
- __webpack_require__(7136);
6814
- __webpack_require__(8636);
6815
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6816
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6817
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6818
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6819
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6820
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
6821
- var PropTypes = __webpack_require__(5556);
6822
- var React = __webpack_require__(1307);
6823
- var BaseUrlContext = __webpack_require__(9357);
6824
-
6825
- // Nabbed from here:
6826
- // https://github.com/readmeio/api-explorer/blob/0dedafcf71102feedaa4145040d3f57d79d95752/packages/api-explorer/src/lib/markdown/renderer.js#L52
6827
- function getHref(href, baseUrl) {
6828
- var _href$split = href.split('#'),
6829
- _href$split2 = _slicedToArray(_href$split, 2),
6830
- path = _href$split2[0],
6831
- hash = _href$split2[1];
6832
- var hashStr = hash ? "#".concat(hash) : '';
6833
- var base = baseUrl === '/' ? '' : baseUrl;
6834
- var doc = path.match(/^doc:([-_a-zA-Z0-9#]*)$/);
6835
- if (doc) {
6836
- return "".concat(base, "/docs/").concat(doc[1]).concat(hashStr);
6837
- }
6838
- var ref = path.match(/^ref:([-_a-zA-Z0-9#]*)$/);
6839
- if (ref) {
6840
- return "".concat(base, "/reference-link/").concat(ref[1]).concat(hashStr);
6841
- }
6842
-
6843
- // we need to perform two matches for changelogs in case
6844
- // of legacy links that use 'blog' instead of 'changelog'
6845
- var blog = path.match(/^blog:([-_a-zA-Z0-9#]*)$/);
6846
- var changelog = path.match(/^changelog:([-_a-zA-Z0-9#]*)$/);
6847
- var changelogMatch = blog || changelog;
6848
- if (changelogMatch) {
6849
- return "".concat(base, "/changelog/").concat(changelogMatch[1]).concat(hashStr);
6850
- }
6851
- var custompage = path.match(/^page:([-_a-zA-Z0-9#]*)$/);
6852
- if (custompage) {
6853
- return "".concat(base, "/page/").concat(custompage[1]).concat(hashStr);
6854
- }
6855
- return href;
6856
- }
6857
- function docLink(href) {
6858
- var doc = href.match(/^doc:([-_a-zA-Z0-9#]*)$/);
6859
- if (!doc) return false;
6860
- return {
6861
- className: 'doc-link',
6862
- 'data-sidebar': doc[1]
6863
- };
6864
- }
6865
- function Anchor(props) {
6866
- var baseUrl = props.baseUrl,
6867
- children = props.children,
6868
- href = props.href,
6869
- target = props.target,
6870
- title = props.title,
6871
- attrs = _objectWithoutProperties(props, _excluded);
6872
- return (
6873
- /*#__PURE__*/
6874
- // eslint-disable-next-line react/jsx-props-no-spreading
6875
- React.createElement("a", _extends({}, attrs, {
6876
- href: getHref(href, baseUrl),
6877
- target: target,
6878
- title: title
6879
- }, docLink(href)), children)
6880
- );
6881
- }
6882
- Anchor.propTypes = {
6883
- baseUrl: PropTypes.string,
6884
- children: PropTypes.node.isRequired,
6885
- download: PropTypes.string,
6886
- href: PropTypes.string,
6887
- target: PropTypes.string,
6888
- title: PropTypes.string
6889
- };
6890
- Anchor.defaultProps = {
6891
- baseUrl: '/',
6892
- href: '',
6893
- target: '',
6894
- title: ''
6895
- };
6896
- var AnchorWithContext = function AnchorWithContext(props) {
6897
- return /*#__PURE__*/React.createElement(BaseUrlContext.Consumer, null, function (baseUrl) {
6898
- return /*#__PURE__*/React.createElement(Anchor, _extends({
6899
- baseUrl: baseUrl
6900
- }, props));
6901
- });
6902
- };
6903
- AnchorWithContext.sanitize = function (sanitizeSchema) {
6904
- // This is for our custom link formats
6905
- sanitizeSchema.protocols.href.push('doc', 'target', 'ref', 'blog', 'changelog', 'page');
6906
- return sanitizeSchema;
6907
- };
6908
- module.exports = AnchorWithContext;
6909
- AnchorWithContext.getHref = getHref;
6910
-
6911
6786
  /***/ }),
6912
6787
 
6913
6788
  /***/ 398:
@@ -7020,14 +6895,6 @@ module.exports = CreateStyle;
7020
6895
 
7021
6896
  /***/ }),
7022
6897
 
7023
- /***/ 9357:
7024
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7025
-
7026
- var React = __webpack_require__(1307);
7027
- module.exports = React.createContext('/');
7028
-
7029
- /***/ }),
7030
-
7031
6898
  /***/ 7965:
7032
6899
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
7033
6900
 
@@ -14253,12 +14120,12 @@ __webpack_require__.d(util_types_namespaceObject, {
14253
14120
  var components_namespaceObject = {};
14254
14121
  __webpack_require__.r(components_namespaceObject);
14255
14122
  __webpack_require__.d(components_namespaceObject, {
14256
- Anchor: () => ((Anchor_default())),
14123
+ Anchor: () => (components_Anchor),
14257
14124
  Callout: () => (components_Callout),
14258
14125
  Code: () => (components_Code),
14259
14126
  CodeTabs: () => (components_CodeTabs),
14260
14127
  Embed: () => (components_Embed),
14261
- GlossaryItem: () => (GlossaryItemWithContext),
14128
+ Glossary: () => (GlossaryWithContext),
14262
14129
  HTMLBlock: () => (components_HTMLBlock),
14263
14130
  Heading: () => ((Heading_default())),
14264
14131
  Image: () => (components_Image),
@@ -60954,9 +60821,159 @@ var jsx_runtime_namespaceObject = /*#__PURE__*/__webpack_require__.t(jsx_runtime
60954
60821
  // EXTERNAL MODULE: external "@readme/variable"
60955
60822
  var variable_ = __webpack_require__(8167);
60956
60823
  var variable_default = /*#__PURE__*/__webpack_require__.n(variable_);
60957
- // EXTERNAL MODULE: ./components/Anchor.jsx
60958
- var Anchor = __webpack_require__(9294);
60959
- var Anchor_default = /*#__PURE__*/__webpack_require__.n(Anchor);
60824
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.js
60825
+ var es_symbol = __webpack_require__(3534);
60826
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.description.js
60827
+ var es_symbol_description = __webpack_require__(590);
60828
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.iterator.js
60829
+ var es_symbol_iterator = __webpack_require__(4216);
60830
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.from.js
60831
+ var es_array_from = __webpack_require__(5195);
60832
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.index-of.js
60833
+ var es_array_index_of = __webpack_require__(9693);
60834
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.iterator.js
60835
+ var es_array_iterator = __webpack_require__(8665);
60836
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.slice.js
60837
+ var es_array_slice = __webpack_require__(4913);
60838
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.date.to-string.js
60839
+ var es_date_to_string = __webpack_require__(9389);
60840
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.function.bind.js
60841
+ var es_function_bind = __webpack_require__(4189);
60842
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.function.name.js
60843
+ var es_function_name = __webpack_require__(8741);
60844
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.assign.js
60845
+ var es_object_assign = __webpack_require__(9218);
60846
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.keys.js
60847
+ var es_object_keys = __webpack_require__(7899);
60848
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
60849
+ var es_object_to_string = __webpack_require__(5086);
60850
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.to-string.js
60851
+ var es_regexp_to_string = __webpack_require__(6048);
60852
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.iterator.js
60853
+ var es_string_iterator = __webpack_require__(9979);
60854
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.iterator.js
60855
+ var web_dom_collections_iterator = __webpack_require__(4602);
60856
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.concat.js
60857
+ var es_array_concat = __webpack_require__(115);
60858
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.is-array.js
60859
+ var es_array_is_array = __webpack_require__(4895);
60860
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.exec.js
60861
+ var es_regexp_exec = __webpack_require__(7136);
60862
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.match.js
60863
+ var es_string_match = __webpack_require__(8636);
60864
+ // EXTERNAL MODULE: ./node_modules/prop-types/index.js
60865
+ var prop_types = __webpack_require__(5556);
60866
+ ;// CONCATENATED MODULE: ./contexts/BaseUrl.js
60867
+
60868
+ var BaseUrlContext = /*#__PURE__*/external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createContext('/');
60869
+ /* harmony default export */ const BaseUrl = (BaseUrlContext);
60870
+ ;// CONCATENATED MODULE: ./components/Anchor.jsx
60871
+
60872
+
60873
+
60874
+
60875
+
60876
+
60877
+
60878
+
60879
+
60880
+
60881
+
60882
+
60883
+
60884
+
60885
+
60886
+
60887
+ var _excluded = ["children", "href", "target", "title"];
60888
+ 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); }
60889
+ 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; }
60890
+ 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; }
60891
+
60892
+
60893
+
60894
+
60895
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
60896
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
60897
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
60898
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
60899
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
60900
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
60901
+
60902
+
60903
+
60904
+
60905
+ // Nabbed from here:
60906
+ // https://github.com/readmeio/api-explorer/blob/0dedafcf71102feedaa4145040d3f57d79d95752/packages/api-explorer/src/lib/markdown/renderer.js#L52
60907
+ function getHref(href, baseUrl) {
60908
+ var _href$split = href.split('#'),
60909
+ _href$split2 = _slicedToArray(_href$split, 2),
60910
+ path = _href$split2[0],
60911
+ hash = _href$split2[1];
60912
+ var hashStr = hash ? "#".concat(hash) : '';
60913
+ var base = baseUrl === '/' ? '' : baseUrl;
60914
+ var doc = path.match(/^doc:([-_a-zA-Z0-9#]*)$/);
60915
+ if (doc) {
60916
+ return "".concat(base, "/docs/").concat(doc[1]).concat(hashStr);
60917
+ }
60918
+ var ref = path.match(/^ref:([-_a-zA-Z0-9#]*)$/);
60919
+ if (ref) {
60920
+ return "".concat(base, "/reference-link/").concat(ref[1]).concat(hashStr);
60921
+ }
60922
+
60923
+ // we need to perform two matches for changelogs in case
60924
+ // of legacy links that use 'blog' instead of 'changelog'
60925
+ var blog = path.match(/^blog:([-_a-zA-Z0-9#]*)$/);
60926
+ var changelog = path.match(/^changelog:([-_a-zA-Z0-9#]*)$/);
60927
+ var changelogMatch = blog || changelog;
60928
+ if (changelogMatch) {
60929
+ return "".concat(base, "/changelog/").concat(changelogMatch[1]).concat(hashStr);
60930
+ }
60931
+ var custompage = path.match(/^page:([-_a-zA-Z0-9#]*)$/);
60932
+ if (custompage) {
60933
+ return "".concat(base, "/page/").concat(custompage[1]).concat(hashStr);
60934
+ }
60935
+ return href;
60936
+ }
60937
+ function docLink(href) {
60938
+ var doc = href.match(/^doc:([-_a-zA-Z0-9#]*)$/);
60939
+ if (!doc) return false;
60940
+ return {
60941
+ className: 'doc-link',
60942
+ 'data-sidebar': doc[1]
60943
+ };
60944
+ }
60945
+ function Anchor(props) {
60946
+ var children = props.children,
60947
+ href = props.href,
60948
+ target = props.target,
60949
+ title = props.title,
60950
+ attrs = _objectWithoutProperties(props, _excluded);
60951
+ var baseUrl = useContext(BaseUrl);
60952
+ return (
60953
+ /*#__PURE__*/
60954
+ // eslint-disable-next-line react/jsx-props-no-spreading
60955
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("a", _extends({}, attrs, {
60956
+ href: getHref(href, baseUrl),
60957
+ target: target,
60958
+ title: title
60959
+ }, docLink(href)), children)
60960
+ );
60961
+ }
60962
+ Anchor.propTypes = {
60963
+ baseUrl: prop_types.string,
60964
+ children: prop_types.node.isRequired,
60965
+ download: prop_types.string,
60966
+ href: prop_types.string,
60967
+ target: prop_types.string,
60968
+ title: prop_types.string
60969
+ };
60970
+ Anchor.defaultProps = {
60971
+ baseUrl: '/',
60972
+ href: '',
60973
+ target: '',
60974
+ title: ''
60975
+ };
60976
+ /* harmony default export */ const components_Anchor = (Anchor);
60960
60977
  ;// CONCATENATED MODULE: ./components/Callout/index.tsx
60961
60978
 
60962
60979
  const themes = {
@@ -61109,28 +61126,25 @@ var react_default = /*#__PURE__*/__webpack_require__.n(react_);
61109
61126
 
61110
61127
  const GlossaryContext = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createContext)([]);
61111
61128
  /* harmony default export */ const GlossaryTerms = (GlossaryContext);
61112
- // haxx
61113
- function Provider(Provider, arg1) {
61114
- throw new Error('Function not implemented.');
61115
- }
61116
61129
 
61117
- ;// CONCATENATED MODULE: ./components/GlossaryItem/index.tsx
61130
+ ;// CONCATENATED MODULE: ./components/Glossary/index.tsx
61118
61131
 
61119
61132
 
61120
61133
 
61121
- const GlossaryItem = ({ term, terms }) => {
61122
- const foundTerm = terms.find(i => term.toLowerCase() === i.term.toLowerCase());
61134
+ const Glossary = ({ children, term: termProp, terms }) => {
61135
+ const term = (Array.isArray(children) ? children[0] : children) || termProp;
61136
+ 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()); });
61123
61137
  if (!foundTerm)
61124
61138
  return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("span", null, term);
61125
- return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement((react_default()), { content: external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "GlossaryItem-tooltip-content" },
61126
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("strong", { className: "GlossaryItem-term" }, foundTerm.term),
61139
+ return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement((react_default()), { content: external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "Glossary-tooltip-content" },
61140
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("strong", { className: "Glossary-term" }, foundTerm.term),
61127
61141
  " - ",
61128
61142
  foundTerm.definition), offset: [-5, 5], placement: "bottom-start" },
61129
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("span", { className: "GlossaryItem-trigger" }, term)));
61143
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("span", { className: "Glossary-trigger" }, term)));
61130
61144
  };
61131
- const GlossaryItemWithContext = props => {
61145
+ const GlossaryWithContext = props => {
61132
61146
  const terms = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useContext)(GlossaryTerms);
61133
- return terms ? external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(GlossaryItem, Object.assign({}, props, { terms: terms })) : null;
61147
+ return terms ? external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Glossary, Object.assign({}, props, { terms: terms })) : external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("span", null, props.term);
61134
61148
  };
61135
61149
 
61136
61150
 
@@ -61225,8 +61239,6 @@ const Table = (props) => {
61225
61239
  };
61226
61240
  /* harmony default export */ const components_Table = (Table);
61227
61241
 
61228
- // EXTERNAL MODULE: ./node_modules/prop-types/index.js
61229
- var prop_types = __webpack_require__(5556);
61230
61242
  ;// CONCATENATED MODULE: ./components/TableOfContents/index.jsx
61231
61243
 
61232
61244
 
@@ -61261,15 +61273,6 @@ TableOfContents.propTypes = {
61261
61273
 
61262
61274
 
61263
61275
 
61264
- // EXTERNAL MODULE: ./contexts/BaseUrl.js
61265
- var BaseUrl = __webpack_require__(9357);
61266
- var BaseUrl_default = /*#__PURE__*/__webpack_require__.n(BaseUrl);
61267
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.js
61268
- var es_symbol = __webpack_require__(3534);
61269
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.description.js
61270
- var es_symbol_description = __webpack_require__(590);
61271
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.iterator.js
61272
- var es_symbol_iterator = __webpack_require__(4216);
61273
61276
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.to-primitive.js
61274
61277
  var es_symbol_to_primitive = __webpack_require__(6611);
61275
61278
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.filter.js
@@ -61278,8 +61281,6 @@ var es_array_filter = __webpack_require__(17);
61278
61281
  var es_array_for_each = __webpack_require__(8476);
61279
61282
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.includes.js
61280
61283
  var es_array_includes = __webpack_require__(7746);
61281
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.iterator.js
61282
- var es_array_iterator = __webpack_require__(8665);
61283
61284
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.date.to-primitive.js
61284
61285
  var es_date_to_primitive = __webpack_require__(7787);
61285
61286
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.number.constructor.js
@@ -61292,18 +61293,10 @@ var es_object_define_property = __webpack_require__(5852);
61292
61293
  var es_object_get_own_property_descriptor = __webpack_require__(678);
61293
61294
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.get-own-property-descriptors.js
61294
61295
  var es_object_get_own_property_descriptors = __webpack_require__(3101);
61295
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.keys.js
61296
- var es_object_keys = __webpack_require__(7899);
61297
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
61298
- var es_object_to_string = __webpack_require__(5086);
61299
61296
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.includes.js
61300
61297
  var es_string_includes = __webpack_require__(3148);
61301
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.iterator.js
61302
- var es_string_iterator = __webpack_require__(9979);
61303
61298
  // EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.for-each.js
61304
61299
  var web_dom_collections_for_each = __webpack_require__(8379);
61305
- // EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.iterator.js
61306
- var web_dom_collections_iterator = __webpack_require__(4602);
61307
61300
  ;// CONCATENATED MODULE: ./options.js
61308
61301
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
61309
61302
  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; }
@@ -78736,6 +78729,21 @@ class MdxSyntaxError extends SyntaxError {
78736
78729
  }
78737
78730
  }
78738
78731
 
78732
+ ;// CONCATENATED MODULE: ./contexts/index.tsx
78733
+
78734
+
78735
+
78736
+
78737
+ const compose = (children, ...contexts) => {
78738
+ return contexts.reduce((content, [Context, value]) => {
78739
+ return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Context.Provider, { value: value }, content);
78740
+ }, children);
78741
+ };
78742
+ const Contexts = ({ children, terms = [], variables = { user: { keys: [] }, defaults: [] }, baseUrl = '/' }) => {
78743
+ return compose(children, [GlossaryTerms, terms], [variable_.VariablesContext, variables], [BaseUrl, baseUrl]);
78744
+ };
78745
+ /* harmony default export */ const contexts = (Contexts);
78746
+
78739
78747
  ;// CONCATENATED MODULE: ./index.tsx
78740
78748
  var index_rest = (undefined && undefined.__rest) || function (s, e) {
78741
78749
  var t = {};
@@ -78765,17 +78773,13 @@ var index_rest = (undefined && undefined.__rest) || function (s, e) {
78765
78773
 
78766
78774
 
78767
78775
 
78768
-
78769
78776
  const unimplemented = browser_default()('mdx:unimplemented');
78770
78777
 
78771
78778
  const utils = {
78772
78779
  get options() {
78773
78780
  return Object.assign({}, options);
78774
78781
  },
78775
- BaseUrlContext: (BaseUrl_default()),
78776
- getHref: Anchor.getHref,
78777
- GlossaryContext: GlossaryTerms,
78778
- VariablesContext: (variable_default()).VariablesContext,
78782
+ getHref: getHref,
78779
78783
  calloutIcons: {},
78780
78784
  };
78781
78785
  const makeUseMDXComponents = (more) => {
@@ -78797,9 +78801,11 @@ const index_compile = (text, opts = {}) => {
78797
78801
  };
78798
78802
  const index_run = async (code, _opts = {}) => {
78799
78803
  const { Fragment } = jsx_runtime_namespaceObject;
78800
- const { components } = _opts, opts = index_rest(_opts, ["components"]);
78804
+ const { components, terms, variables, baseUrl } = _opts, opts = index_rest(_opts, ["components", "terms", "variables", "baseUrl"]);
78801
78805
  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: (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default()) }, useMDXComponents: makeUseMDXComponents(components) }), opts));
78802
- return (file === null || file === void 0 ? void 0 : file.default) || (() => null);
78806
+ const Content = (file === null || file === void 0 ? void 0 : file.default) || (() => null);
78807
+ return () => (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(contexts, { terms: terms, variables: variables, baseUrl: baseUrl },
78808
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Content, null)));
78803
78809
  };
78804
78810
  const reactTOC = (text, opts = {}) => {
78805
78811
  unimplemented('reactTOC');
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: () => ((Anchor_default())),
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
- GlossaryItem: () => (GlossaryItemWithContext),
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: ./components/Anchor.jsx
58241
- var Anchor = __webpack_require__(294);
58242
- var Anchor_default = /*#__PURE__*/__webpack_require__.n(Anchor);
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 = {
@@ -62817,7 +62798,7 @@ var react_dom = __webpack_require__(961);
62817
62798
 
62818
62799
 
62819
62800
 
62820
- function _objectWithoutPropertiesLoose(source, excluded) {
62801
+ function tippy_react_esm_objectWithoutPropertiesLoose(source, excluded) {
62821
62802
  if (source == null) return {};
62822
62803
  var target = {};
62823
62804
  var sourceKeys = Object.keys(source);
@@ -62979,7 +62960,7 @@ function TippyGenerator(tippy) {
62979
62960
  ignoreAttributes = _ref$ignoreAttributes === void 0 ? true : _ref$ignoreAttributes,
62980
62961
  __source = _ref.__source,
62981
62962
  __self = _ref.__self,
62982
- restOfNativeProps = _objectWithoutPropertiesLoose(_ref, ["children", "content", "visible", "singleton", "render", "reference", "disabled", "ignoreAttributes", "__source", "__self"]);
62963
+ restOfNativeProps = tippy_react_esm_objectWithoutPropertiesLoose(_ref, ["children", "content", "visible", "singleton", "render", "reference", "disabled", "ignoreAttributes", "__source", "__self"]);
62983
62964
 
62984
62965
  var isControlledMode = visible !== undefined;
62985
62966
  var isSingletonMode = singleton !== undefined;
@@ -63243,7 +63224,7 @@ function useSingletonGenerator(createSingleton) {
63243
63224
 
63244
63225
  var _sourceData$props = sourceData.props,
63245
63226
  content = _sourceData$props.content,
63246
- props = _objectWithoutPropertiesLoose(_sourceData$props, ["content"]);
63227
+ props = tippy_react_esm_objectWithoutPropertiesLoose(_sourceData$props, ["content"]);
63247
63228
 
63248
63229
  instance.setProps(deepPreserveProps(instance.props, Object.assign({}, props, {
63249
63230
  overrides: overrides
@@ -63309,7 +63290,7 @@ function useSingletonGenerator(createSingleton) {
63309
63290
  var forwardRef = (function (Tippy, defaultProps) {
63310
63291
  return /*#__PURE__*/(0,react.forwardRef)(function TippyWrapper(_ref, _ref2) {
63311
63292
  var children = _ref.children,
63312
- props = _objectWithoutPropertiesLoose(_ref, ["children"]);
63293
+ props = tippy_react_esm_objectWithoutPropertiesLoose(_ref, ["children"]);
63313
63294
 
63314
63295
  return (
63315
63296
  /*#__PURE__*/
@@ -63336,28 +63317,25 @@ var tippy_react_esm_index = /*#__PURE__*/forwardRef( /*#__PURE__*/TippyGenerator
63336
63317
 
63337
63318
  const GlossaryContext = (0,react.createContext)([]);
63338
63319
  /* harmony default export */ const GlossaryTerms = (GlossaryContext);
63339
- // haxx
63340
- function Provider(Provider, arg1) {
63341
- throw new Error('Function not implemented.');
63342
- }
63343
63320
 
63344
- ;// CONCATENATED MODULE: ./components/GlossaryItem/index.tsx
63321
+ ;// CONCATENATED MODULE: ./components/Glossary/index.tsx
63345
63322
 
63346
63323
 
63347
63324
 
63348
- const GlossaryItem = ({ term, terms }) => {
63349
- const foundTerm = terms.find(i => term.toLowerCase() === i.term.toLowerCase());
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()); });
63350
63328
  if (!foundTerm)
63351
63329
  return react.createElement("span", null, term);
63352
- return (react.createElement(tippy_react_esm, { content: react.createElement("div", { className: "GlossaryItem-tooltip-content" },
63353
- react.createElement("strong", { className: "GlossaryItem-term" }, foundTerm.term),
63330
+ return (react.createElement(tippy_react_esm, { content: react.createElement("div", { className: "Glossary-tooltip-content" },
63331
+ react.createElement("strong", { className: "Glossary-term" }, foundTerm.term),
63354
63332
  " - ",
63355
63333
  foundTerm.definition), offset: [-5, 5], placement: "bottom-start" },
63356
- react.createElement("span", { className: "GlossaryItem-trigger" }, term)));
63334
+ react.createElement("span", { className: "Glossary-trigger" }, term)));
63357
63335
  };
63358
- const GlossaryItemWithContext = props => {
63336
+ const GlossaryWithContext = props => {
63359
63337
  const terms = (0,react.useContext)(GlossaryTerms);
63360
- return terms ? react.createElement(GlossaryItem, Object.assign({}, props, { terms: terms })) : null;
63338
+ return terms ? react.createElement(Glossary, Object.assign({}, props, { terms: terms })) : react.createElement("span", null, props.term);
63361
63339
  };
63362
63340
 
63363
63341
 
@@ -63452,8 +63430,6 @@ const Table = (props) => {
63452
63430
  };
63453
63431
  /* harmony default export */ const components_Table = (Table);
63454
63432
 
63455
- // EXTERNAL MODULE: ./node_modules/prop-types/index.js
63456
- var prop_types = __webpack_require__(556);
63457
63433
  ;// CONCATENATED MODULE: ./components/TableOfContents/index.jsx
63458
63434
 
63459
63435
 
@@ -63489,9 +63465,6 @@ TableOfContents.propTypes = {
63489
63465
 
63490
63466
 
63491
63467
 
63492
- // EXTERNAL MODULE: ./contexts/BaseUrl.js
63493
- var BaseUrl = __webpack_require__(357);
63494
- var BaseUrl_default = /*#__PURE__*/__webpack_require__.n(BaseUrl);
63495
63468
  ;// CONCATENATED MODULE: ./options.js
63496
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; }
63497
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; }
@@ -80896,6 +80869,21 @@ class MdxSyntaxError extends SyntaxError {
80896
80869
  }
80897
80870
  }
80898
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
+
80899
80887
  ;// CONCATENATED MODULE: ./index.tsx
80900
80888
  var index_rest = (undefined && undefined.__rest) || function (s, e) {
80901
80889
  var t = {};
@@ -80925,17 +80913,13 @@ var index_rest = (undefined && undefined.__rest) || function (s, e) {
80925
80913
 
80926
80914
 
80927
80915
 
80928
-
80929
80916
  const unimplemented = src_default()('mdx:unimplemented');
80930
80917
 
80931
80918
  const utils = {
80932
80919
  get options() {
80933
80920
  return Object.assign({}, options);
80934
80921
  },
80935
- BaseUrlContext: (BaseUrl_default()),
80936
- getHref: Anchor.getHref,
80937
- GlossaryContext: GlossaryTerms,
80938
- VariablesContext: (dist_default()).VariablesContext,
80922
+ getHref: getHref,
80939
80923
  calloutIcons: {},
80940
80924
  };
80941
80925
  const makeUseMDXComponents = (more) => {
@@ -80957,9 +80941,11 @@ const index_compile = (text, opts = {}) => {
80957
80941
  };
80958
80942
  const index_run = async (code, _opts = {}) => {
80959
80943
  const { Fragment } = jsx_runtime_namespaceObject;
80960
- const { components } = _opts, opts = index_rest(_opts, ["components"]);
80944
+ const { components, terms, variables, baseUrl } = _opts, opts = index_rest(_opts, ["components", "terms", "variables", "baseUrl"]);
80961
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));
80962
- return (file === null || file === void 0 ? void 0 : file.default) || (() => null);
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)));
80963
80949
  };
80964
80950
  const reactTOC = (text, opts = {}) => {
80965
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.35",
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",
@@ -6,4 +6,4 @@
6
6
  @import '../components/Callout/style';
7
7
  @import '../components/Heading/style';
8
8
  @import '../components/Embed/style';
9
- @import '../components/GlossaryItem/style';
9
+ @import '../components/Glossary/style';
@@ -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
- }
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import GlossaryContext from '../../contexts/GlossaryTerms';
3
- import type { GlossaryItem, GlossaryTerm } from '../../contexts/GlossaryTerms';
4
- declare const GlossaryItem: ({ term, terms }: {
5
- term: string;
6
- terms: GlossaryTerm[];
7
- }) => React.JSX.Element;
8
- declare const GlossaryItemWithContext: (props: any) => React.JSX.Element;
9
- export { GlossaryItem, GlossaryItemWithContext as default, GlossaryContext };