@readme/markdown 6.75.0-beta.46 → 6.75.0-beta.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Heading/index.tsx +31 -0
- package/components/TableOfContents/{index.jsx → index.tsx} +1 -6
- package/components/index.ts +0 -1
- package/dist/components/Heading/index.d.ts +8 -0
- package/dist/components/TableOfContents/index.d.ts +3 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/contexts/index.d.ts +1 -1
- package/dist/enums.d.ts +6 -5
- package/dist/index.d.ts +3 -24
- package/dist/lib/ast-processor.d.ts +8 -0
- package/dist/lib/compile.d.ts +9 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/mdx.d.ts +4 -0
- package/dist/lib/run.d.ts +24 -0
- package/dist/main.js +43267 -39572
- package/dist/main.node.js +42760 -39057
- package/dist/processor/transform/index.d.ts +3 -1
- package/dist/processor/transform/readme-to-mdx.d.ts +3 -0
- package/dist/processor/transform/rehype-toc.d.ts +8 -0
- package/package.json +9 -7
- package/components/Heading/index.jsx +0 -56
- package/components/Style.jsx +0 -31
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export type Depth = 1 | 2 | 3 | 4 | 5 | 6;
|
|
4
|
+
|
|
5
|
+
interface Props extends React.PropsWithChildren<React.HTMLAttributes<HTMLHeadingElement>> {
|
|
6
|
+
tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
7
|
+
depth: Depth;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Heading = ({ tag: Tag = 'h3', depth = 3, id, children, ...attrs }: Props) => {
|
|
11
|
+
if (!children) return '';
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Tag {...attrs} className={`heading heading-${depth} header-scroll`}>
|
|
15
|
+
<div key={`heading-anchor-${id}`} className="heading-anchor anchor waypoint" id={id} />
|
|
16
|
+
<div key={`heading-text-${id}`} className="heading-text">
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
<a
|
|
20
|
+
key={`heading-anchor-icon-${id}`}
|
|
21
|
+
aria-label={`Skip link to ${children}`}
|
|
22
|
+
className="heading-anchor-icon fa fa-anchor"
|
|
23
|
+
href={`#${id}`}
|
|
24
|
+
/>
|
|
25
|
+
</Tag>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const CreateHeading = (depth: Depth) => (props: Props) => <Heading {...props} depth={depth} tag={`h${depth}`} />;
|
|
30
|
+
|
|
31
|
+
export default CreateHeading;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { element } from 'prop-types';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
|
|
4
|
-
function TableOfContents({ children }) {
|
|
3
|
+
function TableOfContents({ children }: React.PropsWithChildren) {
|
|
5
4
|
return (
|
|
6
5
|
<nav>
|
|
7
6
|
<ul className="toc-list">
|
|
@@ -18,8 +17,4 @@ function TableOfContents({ children }) {
|
|
|
18
17
|
);
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
TableOfContents.propTypes = {
|
|
22
|
-
children: element,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
20
|
export default TableOfContents;
|
package/components/index.ts
CHANGED
|
@@ -7,6 +7,5 @@ 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';
|
|
10
|
-
export { default as Style } from './Style';
|
|
11
10
|
export { default as Table } from './Table';
|
|
12
11
|
export { default as TableOfContents } from './TableOfContents';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type Depth = 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
|
+
interface Props extends React.PropsWithChildren<React.HTMLAttributes<HTMLHeadingElement>> {
|
|
4
|
+
tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
5
|
+
depth: Depth;
|
|
6
|
+
}
|
|
7
|
+
declare const CreateHeading: (depth: Depth) => (props: Props) => React.JSX.Element;
|
|
8
|
+
export default CreateHeading;
|
|
@@ -7,6 +7,5 @@ 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';
|
|
10
|
-
export { default as Style } from './Style';
|
|
11
10
|
export { default as Table } from './Table';
|
|
12
11
|
export { default as TableOfContents } from './TableOfContents';
|
package/dist/contexts/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RunOpts } from '../
|
|
2
|
+
import { RunOpts } from '../lib/run';
|
|
3
3
|
type Props = React.PropsWithChildren & Pick<RunOpts, 'baseUrl' | 'terms' | 'variables'>;
|
|
4
4
|
declare const Contexts: ({ children, terms, variables, baseUrl }: Props) => React.ReactNode;
|
|
5
5
|
export default Contexts;
|
package/dist/enums.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export declare enum NodeTypes {
|
|
2
2
|
callout = "rdme-callout",
|
|
3
3
|
codeTabs = "code-tabs",
|
|
4
|
+
embed = "embed",
|
|
4
5
|
emoji = "gemoji",
|
|
6
|
+
glossary = "readme-glossary-item",
|
|
7
|
+
htmlBlock = "html-block",
|
|
5
8
|
i = "i",
|
|
6
9
|
image = "image",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
variable = "readme-variable"
|
|
10
|
-
glossary = "readme-glossary-item",
|
|
11
|
-
reusableContent = "reusable-content"
|
|
10
|
+
reusableContent = "reusable-content",
|
|
11
|
+
tutorialTile = "tutorial-tile",
|
|
12
|
+
variable = "readme-variable"
|
|
12
13
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,34 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RunOptions } from '@mdx-js/mdx';
|
|
3
1
|
import * as Components from './components';
|
|
4
|
-
import {
|
|
2
|
+
import { compile, run, mdx } from './lib';
|
|
5
3
|
import './styles/main.scss';
|
|
6
|
-
|
|
7
|
-
interface Variables {
|
|
8
|
-
user: Record<string, string>;
|
|
9
|
-
defaults: {
|
|
10
|
-
name: string;
|
|
11
|
-
default: string;
|
|
12
|
-
}[];
|
|
13
|
-
}
|
|
14
|
-
export type RunOpts = Omit<RunOptions, 'Fragment'> & {
|
|
15
|
-
components?: ComponentOpts;
|
|
16
|
-
imports?: Record<string, unknown>;
|
|
17
|
-
baseUrl?: string;
|
|
18
|
-
terms?: GlossaryTerm[];
|
|
19
|
-
variables?: Variables;
|
|
20
|
-
};
|
|
21
|
-
export { Components };
|
|
22
|
-
export declare const utils: {
|
|
4
|
+
declare const utils: {
|
|
23
5
|
readonly options: any;
|
|
24
6
|
getHref: any;
|
|
25
7
|
calloutIcons: {};
|
|
26
8
|
};
|
|
9
|
+
export { compile, run, mdx, Components, utils };
|
|
27
10
|
export declare const reactProcessor: (opts?: {}) => import("unified").Processor<import("mdast").Root, import("estree").Program, import("estree").Program, import("estree").Program, string>;
|
|
28
|
-
export declare const compile: (text: string, opts?: {}) => string;
|
|
29
|
-
export declare const run: (code: string, _opts?: RunOpts) => Promise<() => React.JSX.Element>;
|
|
30
|
-
export declare const reactTOC: (text: string, opts?: {}) => void;
|
|
31
|
-
export declare const mdx: (tree: any, opts?: {}) => string;
|
|
32
11
|
export declare const html: (text: string, opts?: {}) => void;
|
|
33
12
|
export declare const mdast: any;
|
|
34
13
|
export declare const hast: (text: string, opts?: {}) => import("hast").Root;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import remarkFrontmatter from 'remark-frontmatter';
|
|
2
|
+
import remarkGfm from 'remark-gfm';
|
|
3
|
+
export type MdastOpts = {
|
|
4
|
+
components?: Record<string, string>;
|
|
5
|
+
};
|
|
6
|
+
export declare const remarkPlugins: ((() => (tree: any) => void) | typeof remarkFrontmatter | typeof remarkGfm)[];
|
|
7
|
+
declare const astProcessor: (opts?: MdastOpts) => import("unified").Processor<import("mdast").Root, import("mdast").Root, import("mdast").Root, import("mdast").Root, string>;
|
|
8
|
+
export default astProcessor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CompileOptions } from '@mdx-js/mdx';
|
|
2
|
+
import { VFileWithToc } from '../types';
|
|
3
|
+
export type CompileOpts = CompileOptions & {
|
|
4
|
+
components?: Record<string, VFileWithToc>;
|
|
5
|
+
lazyImages?: boolean;
|
|
6
|
+
safeMode?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const compile: (text: string, opts?: CompileOpts) => VFileWithToc;
|
|
9
|
+
export default compile;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RunOptions } from '@mdx-js/mdx';
|
|
3
|
+
import { VFileWithToc } from '../types';
|
|
4
|
+
import { GlossaryTerm } from '../contexts/GlossaryTerms';
|
|
5
|
+
interface Variables {
|
|
6
|
+
user: Record<string, string>;
|
|
7
|
+
defaults: {
|
|
8
|
+
name: string;
|
|
9
|
+
default: string;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
export type RunOpts = Omit<RunOptions, 'Fragment'> & {
|
|
13
|
+
components?: ComponentOpts;
|
|
14
|
+
imports?: Record<string, unknown>;
|
|
15
|
+
baseUrl?: string;
|
|
16
|
+
terms?: GlossaryTerm[];
|
|
17
|
+
variables?: Variables;
|
|
18
|
+
};
|
|
19
|
+
type ComponentOpts = Record<string, (props: any) => React.ReactNode>;
|
|
20
|
+
declare const run: (stringOrFile: string | VFileWithToc, _opts?: RunOpts) => Promise<{
|
|
21
|
+
default: () => React.JSX.Element;
|
|
22
|
+
toc: () => React.JSX.Element;
|
|
23
|
+
}>;
|
|
24
|
+
export default run;
|