@readme/markdown 6.89.0 → 7.1.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/README.md CHANGED
@@ -64,8 +64,17 @@ Parses mdx to an hast.
64
64
 
65
65
  #### `plain`
66
66
 
67
- > [!NOTE]
68
- > unimplemented
67
+ Parses mdx to a plain string.
68
+
69
+ > [!WARNING]
70
+ > This **does** not `eval` the doc.
71
+
72
+ #### `tags`
73
+
74
+ Returns a list of tag names from the doc.
75
+
76
+ > [!WARNING]
77
+ > This **does** not `eval` the doc.
69
78
 
70
79
  #### `utils`
71
80
 
@@ -0,0 +1,34 @@
1
+ import React, { useState } from 'react';
2
+
3
+ import './style.scss';
4
+
5
+ export const Tab = ({ children }) => {
6
+ return (
7
+ <div className="TabContent">
8
+ {children}
9
+ </div>
10
+ )
11
+ }
12
+
13
+ const Tabs = ({ children }) => {
14
+ const [activeTab, setActiveTab] = useState(0);
15
+
16
+ return (
17
+ <div className="TabGroup">
18
+ <header>
19
+ <nav className="TabGroup-nav">
20
+ {children?.map((tab, index: number) =>
21
+ <button className={`TabGroup-tab${activeTab === index ? '_active' : ''}`} key={tab.props.title} onClick={() => setActiveTab(index)}>
22
+ {tab.props.title}
23
+ </button>
24
+ )}
25
+ </nav>
26
+ </header>
27
+ <section>
28
+ {children && children[activeTab]}
29
+ </section>
30
+ </div>
31
+ );
32
+ };
33
+
34
+ export default Tabs;
@@ -0,0 +1,28 @@
1
+ .TabGroup {
2
+ &-nav {
3
+ border-bottom: solid var(--color-border-default, #{rgba(black, 0.1)});
4
+ margin-bottom: 15px;
5
+ }
6
+
7
+ &-tab {
8
+ background: none;
9
+ border: 0;
10
+ color: var(--color-text-minimum, #637288);
11
+ cursor: pointer;
12
+ font-weight: 600;
13
+ padding: 10px;
14
+
15
+ &_active {
16
+ background: none;
17
+ border: 0;
18
+ border-bottom: solid var(--blue, #118cfd);
19
+ color: var(--blue, #118cfd);
20
+ font-weight: 600;
21
+ padding: 10px;
22
+ }
23
+
24
+ &:hover {
25
+ color: var(--color-text-muted, #4f5a66);
26
+ }
27
+ }
28
+ }
@@ -9,4 +9,5 @@ export { default as HTMLBlock } from './HTMLBlock';
9
9
  export { default as Heading } from './Heading';
10
10
  export { default as Image } from './Image';
11
11
  export { default as Table } from './Table';
12
+ export { default as Tabs, Tab } from './Tabs';
12
13
  export { default as TableOfContents } from './TableOfContents';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import './style.scss';
3
+ export declare const Tab: ({ children }: {
4
+ children: any;
5
+ }) => React.JSX.Element;
6
+ declare const Tabs: ({ children }: {
7
+ children: any;
8
+ }) => React.JSX.Element;
9
+ export default Tabs;
@@ -9,4 +9,5 @@ export { default as HTMLBlock } from './HTMLBlock';
9
9
  export { default as Heading } from './Heading';
10
10
  export { default as Image } from './Image';
11
11
  export { default as Table } from './Table';
12
+ export { default as Tabs, Tab } from './Tabs';
12
13
  export { default as TableOfContents } from './TableOfContents';
package/dist/index.d.ts CHANGED
@@ -5,5 +5,5 @@ declare const utils: {
5
5
  getHref: any;
6
6
  calloutIcons: {};
7
7
  };
8
- export { compile, hast, run, mdast, mdx, plain, remarkPlugins } from './lib';
8
+ export { compile, hast, run, mdast, mdx, plain, remarkPlugins, tags } from './lib';
9
9
  export { Components, utils };
@@ -5,5 +5,6 @@ import mdast from './mdast';
5
5
  import mdx from './mdx';
6
6
  import plain from './plain';
7
7
  import run from './run';
8
+ import tags from './tags';
8
9
  export type { MdastOpts };
9
- export { astProcessor, compile, hast, mdast, mdx, plain, run, remarkPlugins };
10
+ export { astProcessor, compile, hast, mdast, mdx, plain, run, remarkPlugins, tags };
@@ -0,0 +1,2 @@
1
+ declare const tags: (doc: string) => string[];
2
+ export default tags;
package/dist/main.css CHANGED
@@ -1,4 +1,5 @@
1
1
  .CardsGrid{display:grid;gap:20px}.CardsGrid .Card{padding:10px;backdrop-filter:blur(20px);border:1px solid rgba(0,0,0,.1);border-radius:5px;box-shadow:0 1px 2px rgba(0, 0, 0, 0.05),0 2px 5px rgba(0, 0, 0, 0.02)}
2
+ .TabGroup-nav{border-bottom:solid var(--color-border-default, rgba(0, 0, 0, 0.1));margin-bottom:15px}.TabGroup-tab{background:none;border:0;color:var(--color-text-minimum, #637288);cursor:pointer;font-weight:600;padding:10px}.TabGroup-tab_active{background:none;border:0;border-bottom:solid var(--blue, #118cfd);color:var(--blue, #118cfd);font-weight:600;padding:10px}.TabGroup-tab:hover{color:var(--color-text-muted, #4f5a66)}
2
3
  /* BASICS */
3
4
 
4
5
  .CodeMirror {
package/dist/main.js CHANGED
@@ -13246,6 +13246,7 @@ __webpack_require__.d(__webpack_exports__, {
13246
13246
  plain: () => (/* reexport */ lib_plain),
13247
13247
  remarkPlugins: () => (/* reexport */ remarkPlugins),
13248
13248
  run: () => (/* reexport */ lib_run),
13249
+ tags: () => (/* reexport */ lib_tags),
13249
13250
  utils: () => (/* binding */ utils)
13250
13251
  });
13251
13252
 
@@ -13263,8 +13264,10 @@ __webpack_require__.d(components_namespaceObject, {
13263
13264
  HTMLBlock: () => (components_HTMLBlock),
13264
13265
  Heading: () => (components_Heading),
13265
13266
  Image: () => (components_Image),
13267
+ Tab: () => (Tab),
13266
13268
  Table: () => (components_Table),
13267
- TableOfContents: () => (components_TableOfContents)
13269
+ TableOfContents: () => (components_TableOfContents),
13270
+ Tabs: () => (components_Tabs)
13268
13271
  });
13269
13272
 
13270
13273
  // NAMESPACE OBJECT: ./node_modules/micromark/lib/constructs.js
@@ -13762,6 +13765,21 @@ const Table = (props) => {
13762
13765
  };
13763
13766
  /* harmony default export */ const components_Table = (Table);
13764
13767
 
13768
+ ;// CONCATENATED MODULE: ./components/Tabs/index.tsx
13769
+
13770
+
13771
+ const Tab = ({ children }) => {
13772
+ return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "TabContent" }, children));
13773
+ };
13774
+ const Tabs = ({ children }) => {
13775
+ const [activeTab, setActiveTab] = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useState)(0);
13776
+ return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "TabGroup" },
13777
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("header", null,
13778
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("nav", { className: "TabGroup-nav" }, children === null || children === void 0 ? void 0 : children.map((tab, index) => external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("button", { className: `TabGroup-tab${activeTab === index ? '_active' : ''}`, key: tab.props.title, onClick: () => setActiveTab(index) }, tab.props.title)))),
13779
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("section", null, children && children[activeTab])));
13780
+ };
13781
+ /* harmony default export */ const components_Tabs = (Tabs);
13782
+
13765
13783
  ;// CONCATENATED MODULE: ./components/TableOfContents/index.tsx
13766
13784
 
13767
13785
  function TableOfContents({ children }) {
@@ -13789,6 +13807,7 @@ function TableOfContents({ children }) {
13789
13807
 
13790
13808
 
13791
13809
 
13810
+
13792
13811
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.symbol.to-primitive.js
13793
13812
  var es_symbol_to_primitive = __webpack_require__(6611);
13794
13813
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.filter.js
@@ -94062,6 +94081,21 @@ const run_run = async (string, _opts = {}) => {
94062
94081
  };
94063
94082
  /* harmony default export */ const lib_run = (run_run);
94064
94083
 
94084
+ ;// CONCATENATED MODULE: ./lib/tags.ts
94085
+
94086
+
94087
+
94088
+ const tags = (doc) => {
94089
+ const set = new Set();
94090
+ visit(lib_mdast(doc), isMDXElement, (node) => {
94091
+ if (node.name.match(/^[A-Z]/)) {
94092
+ set.add(node.name);
94093
+ }
94094
+ });
94095
+ return Array.from(set);
94096
+ };
94097
+ /* harmony default export */ const lib_tags = (tags);
94098
+
94065
94099
  ;// CONCATENATED MODULE: ./lib/index.ts
94066
94100
 
94067
94101
 
@@ -94072,6 +94106,7 @@ const run_run = async (string, _opts = {}) => {
94072
94106
 
94073
94107
 
94074
94108
 
94109
+
94075
94110
  ;// CONCATENATED MODULE: ./index.tsx
94076
94111
 
94077
94112
 
package/dist/main.node.js CHANGED
@@ -7793,6 +7793,7 @@ __webpack_require__.d(__webpack_exports__, {
7793
7793
  plain: () => (/* reexport */ lib_plain),
7794
7794
  remarkPlugins: () => (/* reexport */ remarkPlugins),
7795
7795
  run: () => (/* reexport */ lib_run),
7796
+ tags: () => (/* reexport */ lib_tags),
7796
7797
  utils: () => (/* binding */ utils)
7797
7798
  });
7798
7799
 
@@ -7810,8 +7811,10 @@ __webpack_require__.d(components_namespaceObject, {
7810
7811
  HTMLBlock: () => (components_HTMLBlock),
7811
7812
  Heading: () => (components_Heading),
7812
7813
  Image: () => (components_Image),
7814
+ Tab: () => (Tab),
7813
7815
  Table: () => (components_Table),
7814
- TableOfContents: () => (components_TableOfContents)
7816
+ TableOfContents: () => (components_TableOfContents),
7817
+ Tabs: () => (components_Tabs)
7815
7818
  });
7816
7819
 
7817
7820
  // NAMESPACE OBJECT: ./node_modules/micromark/lib/constructs.js
@@ -13186,6 +13189,21 @@ const Table = (props) => {
13186
13189
  };
13187
13190
  /* harmony default export */ const components_Table = (Table);
13188
13191
 
13192
+ ;// CONCATENATED MODULE: ./components/Tabs/index.tsx
13193
+
13194
+
13195
+ const Tab = ({ children }) => {
13196
+ return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "TabContent" }, children));
13197
+ };
13198
+ const Tabs = ({ children }) => {
13199
+ const [activeTab, setActiveTab] = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useState)(0);
13200
+ return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "TabGroup" },
13201
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("header", null,
13202
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("nav", { className: "TabGroup-nav" }, children === null || children === void 0 ? void 0 : children.map((tab, index) => external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("button", { className: `TabGroup-tab${activeTab === index ? '_active' : ''}`, key: tab.props.title, onClick: () => setActiveTab(index) }, tab.props.title)))),
13203
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("section", null, children && children[activeTab])));
13204
+ };
13205
+ /* harmony default export */ const components_Tabs = (Tabs);
13206
+
13189
13207
  ;// CONCATENATED MODULE: ./components/TableOfContents/index.tsx
13190
13208
 
13191
13209
  function TableOfContents({ children }) {
@@ -13213,6 +13231,7 @@ function TableOfContents({ children }) {
13213
13231
 
13214
13232
 
13215
13233
 
13234
+
13216
13235
  ;// CONCATENATED MODULE: ./options.js
13217
13236
  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; }
13218
13237
  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; }
@@ -95049,6 +95068,21 @@ const run_run = async (string, _opts = {}) => {
95049
95068
  };
95050
95069
  /* harmony default export */ const lib_run = (run_run);
95051
95070
 
95071
+ ;// CONCATENATED MODULE: ./lib/tags.ts
95072
+
95073
+
95074
+
95075
+ const tags = (doc) => {
95076
+ const set = new Set();
95077
+ visit(lib_mdast(doc), isMDXElement, (node) => {
95078
+ if (node.name.match(/^[A-Z]/)) {
95079
+ set.add(node.name);
95080
+ }
95081
+ });
95082
+ return Array.from(set);
95083
+ };
95084
+ /* harmony default export */ const lib_tags = (tags);
95085
+
95052
95086
  ;// CONCATENATED MODULE: ./lib/index.ts
95053
95087
 
95054
95088
 
@@ -95059,6 +95093,7 @@ const run_run = async (string, _opts = {}) => {
95059
95093
 
95060
95094
 
95061
95095
 
95096
+
95062
95097
  ;// CONCATENATED MODULE: ./index.tsx
95063
95098
 
95064
95099
 
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.89.0",
5
+ "version": "7.1.0",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",