@readme/markdown 8.1.0 → 8.3.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.
Files changed (71) hide show
  1. package/README.md +38 -22
  2. package/components/Accordion/index.tsx +5 -2
  3. package/components/Anchor.jsx +1 -1
  4. package/components/Callout/index.tsx +5 -4
  5. package/components/Cards/index.tsx +17 -5
  6. package/components/Code/index.tsx +11 -2
  7. package/components/CodeTabs/index.tsx +5 -1
  8. package/components/Columns/index.tsx +7 -6
  9. package/components/Embed/index.tsx +10 -7
  10. package/components/Glossary/index.tsx +8 -4
  11. package/components/HTMLBlock/index.tsx +10 -2
  12. package/components/Heading/index.tsx +6 -2
  13. package/components/Image/index.tsx +15 -13
  14. package/components/Table/index.tsx +2 -2
  15. package/components/Tabs/index.tsx +21 -14
  16. package/components/TailwindRoot/index.tsx +3 -1
  17. package/dist/components/Accordion/index.d.ts +7 -6
  18. package/dist/components/Callout/index.d.ts +2 -2
  19. package/dist/components/Cards/index.d.ts +13 -11
  20. package/dist/components/CodeTabs/index.d.ts +5 -1
  21. package/dist/components/Columns/index.d.ts +6 -7
  22. package/dist/components/Embed/index.d.ts +6 -6
  23. package/dist/components/Glossary/index.d.ts +4 -3
  24. package/dist/components/HTMLBlock/index.d.ts +5 -4
  25. package/dist/components/Heading/index.d.ts +1 -1
  26. package/dist/components/Image/index.d.ts +2 -2
  27. package/dist/components/Table/index.d.ts +2 -2
  28. package/dist/components/Tabs/index.d.ts +5 -6
  29. package/dist/components/TailwindRoot/index.d.ts +5 -4
  30. package/dist/contexts/GlossaryTerms.d.ts +4 -4
  31. package/dist/contexts/index.d.ts +2 -2
  32. package/dist/errors/mdx-syntax-error.d.ts +1 -1
  33. package/dist/example/RenderError.d.ts +5 -4
  34. package/dist/lib/ast-processor.d.ts +5 -5
  35. package/dist/lib/compile.d.ts +1 -3
  36. package/dist/lib/hast.d.ts +1 -1
  37. package/dist/lib/mdast.d.ts +3 -1
  38. package/dist/lib/mdastV6.d.ts +4 -1
  39. package/dist/lib/mdx.d.ts +3 -1
  40. package/dist/lib/plain.d.ts +1 -1
  41. package/dist/lib/run.d.ts +6 -12
  42. package/dist/main.js +28652 -28499
  43. package/dist/main.node.js +29301 -29148
  44. package/dist/main.node.js.map +1 -1
  45. package/dist/processor/compile/callout.d.ts +1 -1
  46. package/dist/processor/compile/code-tabs.d.ts +1 -1
  47. package/dist/processor/compile/compatibility.d.ts +20 -31
  48. package/dist/processor/compile/embed.d.ts +1 -1
  49. package/dist/processor/compile/gemoji.d.ts +1 -1
  50. package/dist/processor/compile/html-block.d.ts +1 -1
  51. package/dist/processor/compile/variable.d.ts +1 -1
  52. package/dist/processor/plugin/toc.d.ts +4 -4
  53. package/dist/processor/transform/callouts.d.ts +2 -1
  54. package/dist/processor/transform/code-tabs.d.ts +1 -1
  55. package/dist/processor/transform/compatability.d.ts +1 -1
  56. package/dist/processor/transform/div.d.ts +1 -1
  57. package/dist/processor/transform/embeds.d.ts +1 -1
  58. package/dist/processor/transform/gemoji+.d.ts +1 -1
  59. package/dist/processor/transform/images.d.ts +1 -1
  60. package/dist/processor/transform/index.d.ts +4 -4
  61. package/dist/processor/transform/inject-components.d.ts +2 -2
  62. package/dist/processor/transform/mdx-to-hast.d.ts +1 -1
  63. package/dist/processor/transform/mermaid.d.ts +1 -1
  64. package/dist/processor/transform/readme-components.d.ts +1 -1
  65. package/dist/processor/transform/readme-to-mdx.d.ts +1 -1
  66. package/dist/processor/transform/tables-to-jsx.d.ts +1 -1
  67. package/dist/processor/transform/tailwind.d.ts +1 -1
  68. package/dist/processor/transform/variables.d.ts +1 -1
  69. package/dist/processor/utils.d.ts +9 -8
  70. package/dist/utils/user.d.ts +2 -2
  71. package/package.json +4 -1
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- declare const HTMLBlock: ({ children, runScripts, safeMode }: {
3
- children?: string;
4
- runScripts: any;
2
+ interface Props {
3
+ children: React.ReactElement | string;
4
+ runScripts?: boolean | string;
5
5
  safeMode?: boolean;
6
- }) => React.JSX.Element;
6
+ }
7
+ declare const HTMLBlock: ({ children, runScripts, safeMode }: Props) => React.JSX.Element;
7
8
  export default HTMLBlock;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  export type Depth = 1 | 2 | 3 | 4 | 5 | 6;
3
3
  interface Props extends React.PropsWithChildren<React.HTMLAttributes<HTMLHeadingElement>> {
4
- tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
5
4
  depth: Depth;
5
+ tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
6
6
  }
7
7
  declare const CreateHeading: (depth: Depth) => (props: Props) => React.JSX.Element;
8
8
  export default CreateHeading;
@@ -4,13 +4,13 @@ interface ImageProps {
4
4
  alt?: string;
5
5
  border?: boolean;
6
6
  caption?: string;
7
+ children?: [React.ReactElement];
7
8
  className?: string;
8
9
  height?: string;
10
+ lazy?: boolean;
9
11
  src: string;
10
12
  title?: string;
11
13
  width?: string;
12
- lazy?: boolean;
13
- children?: [React.ReactElement];
14
14
  }
15
15
  declare const Image: (Props: ImageProps) => React.JSX.Element;
16
16
  export default Image;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  interface Props extends JSX.IntrinsicAttributes {
3
- align: ('left' | 'center' | 'right')[];
4
- children: [React.ReactElement<HTMLTableCaptionElement | HTMLTableSectionElement | HTMLTableRowElement>];
3
+ align: ('center' | 'left' | 'right')[];
4
+ children: [React.ReactElement<HTMLTableCaptionElement | HTMLTableRowElement | HTMLTableSectionElement>];
5
5
  }
6
6
  declare const Table: (props: Props) => React.JSX.Element;
7
7
  export default Table;
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
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;
3
+ export declare const Tab: ({ children }: React.PropsWithChildren) => React.JSX.Element;
4
+ interface TabsProps {
5
+ children?: React.ReactElement[];
6
+ }
7
+ declare const Tabs: ({ children }: TabsProps) => React.JSX.Element;
9
8
  export default Tabs;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- declare const TailwindRoot: ({ children, flow }: {
3
- children: any;
4
- flow: any;
5
- }) => React.JSX.Element;
2
+ interface Props extends React.PropsWithChildren<{
3
+ flow: boolean;
4
+ }> {
5
+ }
6
+ declare const TailwindRoot: ({ children, flow }: Props) => React.JSX.Element;
6
7
  export default TailwindRoot;
@@ -1,7 +1,7 @@
1
- export type GlossaryTerm = {
2
- term: string;
3
- definition: string;
1
+ export interface GlossaryTerm {
4
2
  _id?: string;
5
- };
3
+ definition: string;
4
+ term: string;
5
+ }
6
6
  declare const GlossaryContext: import("react").Context<GlossaryTerm[]>;
7
7
  export default GlossaryContext;
@@ -1,5 +1,5 @@
1
+ import type { RunOpts } from '../lib/run';
1
2
  import React from 'react';
2
- import { RunOpts } from '../lib/run';
3
- type Props = React.PropsWithChildren & Pick<RunOpts, 'baseUrl' | 'terms' | 'variables'>;
3
+ type Props = Pick<RunOpts, 'baseUrl' | 'terms' | 'variables'> & React.PropsWithChildren;
4
4
  declare const Contexts: ({ children, terms, variables, baseUrl }: Props) => React.ReactNode;
5
5
  export default Contexts;
@@ -1,4 +1,4 @@
1
- import { VFileMessage } from 'vfile-message';
1
+ import type { VFileMessage } from 'vfile-message';
2
2
  export default class MdxSyntaxError extends SyntaxError {
3
3
  original: VFileMessage;
4
4
  constructor(error: VFileMessage, doc: string);
@@ -1,4 +1,5 @@
1
- import React, { PropsWithChildren } from 'react';
1
+ import type { PropsWithChildren } from 'react';
2
+ import React from 'react';
2
3
  interface Props {
3
4
  error?: string;
4
5
  }
@@ -15,9 +16,9 @@ declare class RenderError extends React.Component<PropsWithChildren<Props>, Stat
15
16
  hasError: boolean;
16
17
  message: string;
17
18
  };
18
- componentDidCatch(error: any, info: {
19
- componentStack: any;
19
+ static componentDidCatch(error: Error, info: {
20
+ componentStack: string;
20
21
  }): void;
21
- render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode>;
22
+ render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element;
22
23
  }
23
24
  export default RenderError;
@@ -1,12 +1,12 @@
1
+ import type { PluggableList } from 'unified';
2
+ import rehypeSlug from 'rehype-slug';
1
3
  import remarkFrontmatter from 'remark-frontmatter';
2
4
  import remarkGfm from 'remark-gfm';
3
- import rehypeSlug from 'rehype-slug';
4
- import { PluggableList } from 'unified';
5
- export type MdastOpts = {
5
+ export interface MdastOpts {
6
6
  components?: Record<string, string>;
7
7
  remarkPlugins?: PluggableList;
8
- };
9
- export declare const remarkPlugins: ((() => (tree: any) => void) | (({ copyButtons }?: {
8
+ }
9
+ export declare const remarkPlugins: ((() => (tree: import("mdast").Root) => void) | (({ copyButtons }?: {
10
10
  copyButtons?: boolean;
11
11
  }) => (tree: import("mdast").Node) => import("mdast").Node) | typeof remarkFrontmatter | typeof remarkGfm)[];
12
12
  export declare const rehypePlugins: ((() => (tree: import("unist").Node) => import("unist").Node) | typeof rehypeSlug)[];
@@ -1,7 +1,5 @@
1
- import { CompileOptions } from '@mdx-js/mdx';
1
+ import type { CompileOptions } from '@mdx-js/mdx';
2
2
  export type CompileOpts = CompileOptions & {
3
- lazyImages?: boolean;
4
- safeMode?: boolean;
5
3
  components?: Record<string, string>;
6
4
  copyButtons?: boolean;
7
5
  useTailwind?: boolean;
@@ -1,3 +1,3 @@
1
- import { MdastOpts } from './ast-processor';
1
+ import type { MdastOpts } from './ast-processor';
2
2
  declare const hast: (text: string, opts?: MdastOpts) => import("hast").Root;
3
3
  export default hast;
@@ -1,2 +1,4 @@
1
- declare const mdast: any;
1
+ import type { MdastOpts } from './ast-processor';
2
+ import type { Root } from 'mdast';
3
+ declare const mdast: (text: string, opts?: MdastOpts) => Root;
2
4
  export default mdast;
@@ -1,2 +1,5 @@
1
- declare const mdastV6: any;
1
+ import type { Root } from 'mdast';
2
+ declare const mdastV6: (doc: string, { rdmd }: {
3
+ rdmd: any;
4
+ }) => Root;
2
5
  export default mdastV6;
package/dist/lib/mdx.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- export declare const mdx: (tree: any, { hast, ...opts }?: {
1
+ import type { Root as HastRoot } from 'hast';
2
+ import type { Root as MdastRoot } from 'mdast';
3
+ export declare const mdx: (tree: HastRoot | MdastRoot, { hast, ...opts }?: {
2
4
  hast?: boolean;
3
5
  }) => string;
4
6
  export default mdx;
@@ -1,4 +1,4 @@
1
- import { Nodes } from 'hast';
1
+ import type { Nodes } from 'hast';
2
2
  interface Options {
3
3
  variables?: Record<string, string>;
4
4
  }
package/dist/lib/run.d.ts CHANGED
@@ -1,19 +1,13 @@
1
- import React from 'react';
2
- import { RunOptions } from '@mdx-js/mdx';
3
- import { GlossaryTerm } from '../contexts/GlossaryTerms';
4
- import { CustomComponents } from '../types';
5
- import { Variables } from '../utils/user';
1
+ import type { GlossaryTerm } from '../contexts/GlossaryTerms';
2
+ import type { CustomComponents, RMDXModule } from '../types';
3
+ import type { Variables } from '../utils/user';
4
+ import type { RunOptions } from '@mdx-js/mdx';
6
5
  export type RunOpts = Omit<RunOptions, 'Fragment'> & {
6
+ baseUrl?: string;
7
7
  components?: CustomComponents;
8
8
  imports?: Record<string, unknown>;
9
- baseUrl?: string;
10
9
  terms?: GlossaryTerm[];
11
10
  variables?: Variables;
12
11
  };
13
- declare const run: (string: string, _opts?: RunOpts) => Promise<{
14
- default: () => React.JSX.Element;
15
- toc: import("../types").IndexableElements[];
16
- Toc: () => React.JSX.Element;
17
- stylesheet: string;
18
- }>;
12
+ declare const run: (string: string, _opts?: RunOpts) => Promise<RMDXModule>;
19
13
  export default run;