@readme/markdown 9.1.5 → 9.2.0

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/dist/main.node.js CHANGED
@@ -16342,6 +16342,12 @@ const CardsGrid = ({ columns = 2, children }) => {
16342
16342
  // EXTERNAL MODULE: ./node_modules/copy-to-clipboard/index.js
16343
16343
  var copy_to_clipboard = __webpack_require__(7965);
16344
16344
  var copy_to_clipboard_default = /*#__PURE__*/__webpack_require__.n(copy_to_clipboard);
16345
+ ;// ./contexts/CodeOpts.ts
16346
+
16347
+ // used for the copyButtons prop
16348
+ const CodeOptsContext = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createContext)(false);
16349
+ /* harmony default export */ const CodeOpts = (CodeOptsContext);
16350
+
16345
16351
  ;// ./contexts/Theme.ts
16346
16352
 
16347
16353
  const ThemeContext = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createContext)('light');
@@ -16351,6 +16357,7 @@ const ThemeContext = (0,external_amd_react_commonjs_react_commonjs2_react_root_R
16351
16357
 
16352
16358
 
16353
16359
 
16360
+
16354
16361
  // Only load CodeMirror in the browser, for SSR
16355
16362
  // apps. Necessary because of people like this:
16356
16363
  // https://github.com/codemirror/CodeMirror/issues/3701#issuecomment-164904534
@@ -16377,8 +16384,9 @@ function CopyCode({ codeRef, rootClass = 'rdmd-code-copy', className = '', }) {
16377
16384
  return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("button", { ref: buttonRef, "aria-label": "Copy Code", className: `${rootClass} ${className}`, onClick: copier });
16378
16385
  }
16379
16386
  const Code = (props) => {
16380
- const { children, copyButtons, lang, value } = props;
16387
+ const { children, lang, value } = props;
16381
16388
  const theme = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useContext)(Theme);
16389
+ const copyButtons = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useContext)(CodeOpts) || props.copyButtons;
16382
16390
  const language = canonicalLanguage(lang);
16383
16391
  const codeRef = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createRef)();
16384
16392
  const codeOpts = {
@@ -21477,11 +21485,8 @@ const GlossaryWithContext = (props) => {
21477
21485
 
21478
21486
  /* harmony default export */ const components_Glossary = (GlossaryWithContext);
21479
21487
 
21480
- ;// external {"amd":"react-dom/server","commonjs2":"react-dom/server","commonjs":"react-dom/server","root":"ReactDOM/server","umd":"react-dom/server"}
21481
- const server_namespaceObject = require("react-dom/server");
21482
21488
  ;// ./components/HTMLBlock/index.tsx
21483
21489
 
21484
-
21485
21490
  const MATCH_SCRIPT_TAGS = /<script\b[^>]*>([\s\S]*?)<\/script *>\n?/gim;
21486
21491
  const extractScripts = (html = '') => {
21487
21492
  const scripts = [];
@@ -21494,11 +21499,12 @@ const extractScripts = (html = '') => {
21494
21499
  return [cleaned, () => scripts.map(js => window.eval(js))];
21495
21500
  };
21496
21501
  const HTMLBlock = ({ children = '', runScripts, safeMode = false }) => {
21497
- let html = children;
21502
+ if (typeof children !== 'string') {
21503
+ throw new TypeError('HTMLBlock: children must be a string');
21504
+ }
21505
+ const html = children;
21498
21506
  // eslint-disable-next-line no-param-reassign
21499
21507
  runScripts = typeof runScripts !== 'boolean' ? runScripts === 'true' : runScripts;
21500
- if (typeof html !== 'string')
21501
- html = (0,server_namespaceObject.renderToStaticMarkup)(html);
21502
21508
  const [cleanedHtml, exec] = extractScripts(html);
21503
21509
  (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useEffect)(() => {
21504
21510
  if (typeof window !== 'undefined' && typeof runScripts === 'boolean' && runScripts)
@@ -103811,13 +103817,14 @@ var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
103811
103817
 
103812
103818
 
103813
103819
 
103820
+
103814
103821
  const compose = (children, ...contexts) => {
103815
103822
  return contexts.reduce((content, [Context, value]) => {
103816
103823
  return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Context.Provider, { value: value }, content);
103817
103824
  }, children);
103818
103825
  };
103819
- const Contexts = ({ children, terms = [], variables = { user: {}, defaults: [] }, baseUrl = '/', theme }) => {
103820
- return compose(children, [GlossaryTerms, terms], [dist.VariablesContext, variables], [BaseUrl, baseUrl], [Theme, theme]);
103826
+ const Contexts = ({ children, terms = [], variables = { user: {}, defaults: [] }, baseUrl = '/', theme, copyButtons }) => {
103827
+ return compose(children, [GlossaryTerms, terms], [dist.VariablesContext, variables], [BaseUrl, baseUrl], [Theme, theme], [CodeOpts, copyButtons]);
103821
103828
  };
103822
103829
  /* harmony default export */ const contexts = (Contexts);
103823
103830
 
@@ -103878,7 +103885,7 @@ const makeUseMDXComponents = (more = {}) => {
103878
103885
 
103879
103886
  const run_run = async (string, _opts = {}) => {
103880
103887
  const { Fragment } = jsx_runtime_namespaceObject;
103881
- const { components = {}, terms, variables, baseUrl, imports = {}, theme, ...opts } = _opts;
103888
+ const { components = {}, terms, variables, baseUrl, imports = {}, theme, copyButtons, ...opts } = _opts;
103882
103889
  const tocsByTag = {};
103883
103890
  const exportedComponents = Object.entries(components).reduce((memo, [tag, mod]) => {
103884
103891
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -103912,7 +103919,7 @@ const run_run = async (string, _opts = {}) => {
103912
103919
  Toc = tocModule.default;
103913
103920
  }
103914
103921
  return {
103915
- default: (props) => (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(contexts, { baseUrl: baseUrl, terms: terms, theme: theme, variables: variables },
103922
+ default: (props) => (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(contexts, { baseUrl: baseUrl, copyButtons: copyButtons, terms: terms, theme: theme, variables: variables },
103916
103923
  external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Content, { ...props }))),
103917
103924
  toc,
103918
103925
  Toc: props => Toc ? (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(components_TableOfContents, null,