handoff-app 1.1.2 → 1.1.3-1
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/Changelog.md +81 -0
- package/dist/app-builder/build.js +2 -0
- package/dist/app-builder/watchers.d.ts +9 -1
- package/dist/app-builder/watchers.js +59 -5
- package/dist/cli.js +1 -1
- package/package.json +2 -1
- package/src/app/components/ComponentGuidelines.tsx +3 -1
- package/src/app/components/Markdown/MarkdownComponents.tsx +183 -50
- package/src/app/components/Navigation/AnchorNav.tsx +28 -28
- package/src/app/components/util/index.ts +99 -79
- package/src/app/css/index.css +4 -0
- package/src/app/pages/{[level1] → [...slug]}/index.tsx +24 -31
- package/src/app/pages/assets/fonts.tsx +3 -2
- package/src/app/pages/assets/index.tsx +3 -2
- package/src/app/pages/assets/logos.tsx +3 -2
- package/src/app/pages/foundations/colors.tsx +3 -2
- package/src/app/pages/foundations/effects.tsx +3 -2
- package/src/app/pages/foundations/icons/index.tsx +3 -2
- package/src/app/pages/foundations/index.tsx +3 -2
- package/src/app/pages/foundations/logo.tsx +3 -2
- package/src/app/pages/foundations/typography.tsx +3 -2
- package/src/app/pages/index.tsx +3 -2
- package/src/app/pages/system/component/[component]/index.tsx +3 -2
- package/src/app/pages/system/index.tsx +3 -2
- package/src/app/pages/system/tokens/foundations/colors.tsx +3 -2
- package/src/app/pages/system/tokens/foundations/effects.tsx +3 -2
- package/src/app/pages/system/tokens/foundations/typography.tsx +3 -2
- package/src/app-builder/build.ts +3 -1
- package/src/app-builder/watchers.ts +66 -4
- package/src/cli.ts +1 -1
- package/src/app/pages/[level1]/[level2]/index.tsx +0 -104
|
@@ -7,13 +7,12 @@ import { Types as CoreTypes } from 'handoff-core';
|
|
|
7
7
|
import { groupBy, startCase, uniq } from 'lodash';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import { ParsedUrlQuery } from 'querystring';
|
|
10
|
-
import { SubPageType } from '../../pages/[level1]/[level2]';
|
|
11
|
-
|
|
12
10
|
// Get the parsed url string type
|
|
13
11
|
export interface IParams extends ParsedUrlQuery {
|
|
14
|
-
slug: string;
|
|
12
|
+
slug: string | string[];
|
|
15
13
|
}
|
|
16
14
|
|
|
15
|
+
|
|
17
16
|
// Type for the metadata from frontmatter
|
|
18
17
|
export interface Metadata {
|
|
19
18
|
title: string;
|
|
@@ -93,6 +92,12 @@ export const knownPaths = [
|
|
|
93
92
|
'foundations/typography',
|
|
94
93
|
'system',
|
|
95
94
|
'system/component',
|
|
95
|
+
'system/tokens',
|
|
96
|
+
'system/tokens/foundations',
|
|
97
|
+
'system/tokens/foundations/colors',
|
|
98
|
+
'system/tokens/foundations/effects',
|
|
99
|
+
'system/tokens/foundations/typography',
|
|
100
|
+
'system/tokens/components',
|
|
96
101
|
];
|
|
97
102
|
|
|
98
103
|
/**
|
|
@@ -118,95 +123,99 @@ export const pluralizeComponent = (singular: string): string => {
|
|
|
118
123
|
};
|
|
119
124
|
|
|
120
125
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
126
|
+
* Recursively collect all .md files from a directory, returning their
|
|
127
|
+
* path segments relative to the root (without the .md extension).
|
|
123
128
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
const collectMarkdownPaths = (rootDir: string, relativeParts: string[] = []): string[][] => {
|
|
130
|
+
if (!fs.existsSync(rootDir)) return [];
|
|
131
|
+
const entries = fs.readdirSync(rootDir);
|
|
132
|
+
const results: string[][] = [];
|
|
133
|
+
for (const entry of entries) {
|
|
134
|
+
const fullPath = path.join(rootDir, entry);
|
|
135
|
+
if (fs.lstatSync(fullPath).isDirectory()) {
|
|
136
|
+
results.push(...collectMarkdownPaths(fullPath, [...relativeParts, entry]));
|
|
137
|
+
} else if (entry.endsWith('.md') && entry !== 'index.md') {
|
|
138
|
+
results.push([...relativeParts, entry.replace('.md', '')]);
|
|
139
|
+
}
|
|
132
140
|
}
|
|
133
|
-
|
|
134
|
-
.filter((fileName) => {
|
|
135
|
-
if (fs.existsSync(path.join(docRoot, fileName))) return !fs.lstatSync(path.join(docRoot, fileName)).isDirectory();
|
|
136
|
-
if (fs.existsSync(path.join(pageRoot, fileName))) return !fs.lstatSync(path.join(pageRoot, fileName)).isDirectory();
|
|
137
|
-
return false;
|
|
138
|
-
})
|
|
139
|
-
.filter((fileName) => fileName.endsWith('.md'))
|
|
140
|
-
.map((fileName) => {
|
|
141
|
-
const path = fileName.replace('.md', '');
|
|
142
|
-
if (knownPaths.indexOf(path) < 0) {
|
|
143
|
-
return {
|
|
144
|
-
params: {
|
|
145
|
-
level1: path,
|
|
146
|
-
},
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
})
|
|
150
|
-
.filter(filterOutUndefined);
|
|
151
|
-
return paths;
|
|
141
|
+
return results;
|
|
152
142
|
};
|
|
153
143
|
|
|
154
144
|
/**
|
|
155
|
-
* Build static paths for
|
|
156
|
-
*
|
|
145
|
+
* Build catch-all static paths for all markdown pages at any depth.
|
|
146
|
+
* Excludes paths in knownPaths (those have dedicated route files).
|
|
157
147
|
*/
|
|
158
|
-
export const
|
|
148
|
+
export const buildCatchAllStaticPaths = () => {
|
|
159
149
|
const docRoot = path.resolve(process.env.HANDOFF_MODULE_PATH ?? '', 'config/docs');
|
|
160
|
-
const files = fs.readdirSync(docRoot);
|
|
161
150
|
const pageRoot = path.resolve(process.env.HANDOFF_WORKING_PATH ?? '', 'pages');
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
151
|
+
|
|
152
|
+
const docPaths = collectMarkdownPaths(docRoot);
|
|
153
|
+
const pagePaths = collectMarkdownPaths(pageRoot);
|
|
154
|
+
|
|
155
|
+
const seen = new Set<string>();
|
|
156
|
+
const allPaths: string[][] = [];
|
|
157
|
+
|
|
158
|
+
// Pages override docs (working copy wins)
|
|
159
|
+
for (const segments of [...pagePaths, ...docPaths]) {
|
|
160
|
+
const key = segments.join('/');
|
|
161
|
+
if (!seen.has(key)) {
|
|
162
|
+
seen.add(key);
|
|
163
|
+
allPaths.push(segments);
|
|
164
|
+
}
|
|
166
165
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
})
|
|
194
|
-
.filter(filterOutUndefined);
|
|
166
|
+
|
|
167
|
+
return allPaths
|
|
168
|
+
.filter((segments) => knownPaths.indexOf(segments.join('/')) < 0)
|
|
169
|
+
.map((segments) => ({ params: { slug: segments } }));
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Recursively build menu entries from .md files in a directory.
|
|
174
|
+
* Returns sub-section items with nested menu items for subdirectories.
|
|
175
|
+
*/
|
|
176
|
+
const buildMenuFromDirectory = (dirPath: string, urlPrefix: string): any[] => {
|
|
177
|
+
if (!fs.existsSync(dirPath)) return [];
|
|
178
|
+
const entries = fs.readdirSync(dirPath);
|
|
179
|
+
const items: any[] = [];
|
|
180
|
+
|
|
181
|
+
for (const entry of entries) {
|
|
182
|
+
const fullPath = path.join(dirPath, entry);
|
|
183
|
+
if (fs.lstatSync(fullPath).isDirectory()) {
|
|
184
|
+
const nestedItems = buildMenuFromDirectory(fullPath, `${urlPrefix}/${entry}`);
|
|
185
|
+
if (nestedItems.length > 0) {
|
|
186
|
+
items.push({
|
|
187
|
+
title: startCase(entry),
|
|
188
|
+
path: `${urlPrefix}/${entry}`,
|
|
189
|
+
menu: nestedItems,
|
|
190
|
+
});
|
|
195
191
|
}
|
|
196
|
-
})
|
|
197
|
-
|
|
198
|
-
|
|
192
|
+
} else if (entry.endsWith('.md') && entry !== 'index.md') {
|
|
193
|
+
const slug = entry.replace('.md', '');
|
|
194
|
+
const fullSlugPath = `${urlPrefix}/${slug}`.replace(/^\/+/, '');
|
|
195
|
+
if (knownPaths.indexOf(fullSlugPath) >= 0) continue;
|
|
196
|
+
|
|
197
|
+
const contents = fs.readFileSync(fullPath, 'utf-8');
|
|
198
|
+
const { data: metadata } = matter(contents);
|
|
199
|
+
if (metadata.enabled === false) continue;
|
|
200
|
+
|
|
201
|
+
items.push({
|
|
202
|
+
title: metadata.menuTitle ?? metadata.title ?? startCase(slug),
|
|
203
|
+
path: `/${fullSlugPath}`,
|
|
204
|
+
weight: metadata.weight ?? 0,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return items.sort((a, b) => (a.weight ?? 0) - (b.weight ?? 0));
|
|
199
210
|
};
|
|
200
211
|
|
|
201
212
|
/**
|
|
202
|
-
* Build the static menu for
|
|
213
|
+
* Build the static menu for rendering pages
|
|
203
214
|
* @returns SectionLink[]
|
|
204
215
|
*/
|
|
205
216
|
export const staticBuildMenu = () => {
|
|
206
|
-
// // Contents of docs
|
|
207
217
|
const docRoot = path.join(process.env.HANDOFF_MODULE_PATH ?? '', 'config/docs');
|
|
208
|
-
|
|
209
|
-
if(!fs.existsSync(docRoot)) {
|
|
218
|
+
if (!fs.existsSync(docRoot)) {
|
|
210
219
|
return [];
|
|
211
220
|
}
|
|
212
221
|
const files = fs.readdirSync(docRoot);
|
|
@@ -218,7 +227,6 @@ export const staticBuildMenu = () => {
|
|
|
218
227
|
list = list.concat(pages);
|
|
219
228
|
}
|
|
220
229
|
const sections: SectionLink[] = [];
|
|
221
|
-
// Build path tree
|
|
222
230
|
const custom = uniq(list)
|
|
223
231
|
.map((fileName: string) => {
|
|
224
232
|
let search = '';
|
|
@@ -243,19 +251,16 @@ export const staticBuildMenu = () => {
|
|
|
243
251
|
let subSections = [];
|
|
244
252
|
|
|
245
253
|
if (metadata.menu) {
|
|
246
|
-
// Build the submenu
|
|
247
254
|
subSections = Object.keys(metadata.menu)
|
|
248
255
|
.map((key) => {
|
|
249
256
|
const sub = metadata.menu[key];
|
|
250
257
|
if (sub.components) {
|
|
251
|
-
// The user wants to inject the component menu here
|
|
252
258
|
return {
|
|
253
259
|
title: sub.title,
|
|
254
260
|
menu: staticBuildComponentMenu(sub.components),
|
|
255
261
|
};
|
|
256
262
|
}
|
|
257
263
|
if (sub.tokens) {
|
|
258
|
-
// The user wants to inject the component menu here
|
|
259
264
|
return {
|
|
260
265
|
title: 'Tokens',
|
|
261
266
|
menu: staticBuildTokensMenu(),
|
|
@@ -266,6 +271,21 @@ export const staticBuildMenu = () => {
|
|
|
266
271
|
}
|
|
267
272
|
})
|
|
268
273
|
.filter(filterOutUndefined);
|
|
274
|
+
} else {
|
|
275
|
+
// Only auto-scan directories when no frontmatter menu is defined
|
|
276
|
+
const dirName = fileName.replace('.md', '');
|
|
277
|
+
const docDir = path.resolve(docRoot, dirName);
|
|
278
|
+
const pagesDir = path.resolve(workingPages, dirName);
|
|
279
|
+
const nestedFromDocs = buildMenuFromDirectory(docDir, `/${dirName}`);
|
|
280
|
+
const nestedFromPages = buildMenuFromDirectory(pagesDir, `/${dirName}`);
|
|
281
|
+
|
|
282
|
+
const seenPaths = new Set<string>();
|
|
283
|
+
for (const item of [...nestedFromPages, ...nestedFromDocs]) {
|
|
284
|
+
if (item.path && !seenPaths.has(item.path)) {
|
|
285
|
+
seenPaths.add(item.path);
|
|
286
|
+
subSections.push(item);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
269
289
|
}
|
|
270
290
|
|
|
271
291
|
let external: string | boolean = false;
|
package/src/app/css/index.css
CHANGED
|
@@ -1,56 +1,46 @@
|
|
|
1
1
|
import { GetStaticProps } from 'next';
|
|
2
2
|
import Head from 'next/head';
|
|
3
3
|
import Link from 'next/link';
|
|
4
|
+
import { useRef } from 'react';
|
|
4
5
|
import ReactMarkdown from 'react-markdown';
|
|
5
6
|
import rehypeRaw from 'rehype-raw';
|
|
7
|
+
import remarkGfm from 'remark-gfm';
|
|
6
8
|
import Layout from '../../components/Layout/Main';
|
|
7
|
-
import { MarkdownComponents } from '../../components/Markdown/MarkdownComponents';
|
|
9
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
10
|
+
import { PageTOC } from '../../components/Navigation/AnchorNav';
|
|
8
11
|
import HeadersType from '../../components/Typography/Headers';
|
|
9
12
|
import {
|
|
10
|
-
|
|
13
|
+
buildCatchAllStaticPaths,
|
|
11
14
|
DocumentationProps,
|
|
12
15
|
fetchDocPageMarkdown,
|
|
13
16
|
getClientRuntimeConfig,
|
|
14
|
-
IParams,
|
|
15
|
-
reduceSlugToString,
|
|
16
17
|
} from '../../components/util';
|
|
17
18
|
|
|
18
|
-
/**
|
|
19
|
-
* Render all index pages
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
19
|
export async function getStaticPaths() {
|
|
23
20
|
return {
|
|
24
|
-
paths:
|
|
21
|
+
paths: buildCatchAllStaticPaths(),
|
|
25
22
|
fallback: false,
|
|
26
23
|
};
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
/**
|
|
30
|
-
* Get all the markdown data, build a menu tree, and then fetch the contents
|
|
31
|
-
* of the current page for rendering
|
|
32
|
-
*
|
|
33
|
-
* This is all done statically at build time
|
|
34
|
-
* @param context GetStaticProps
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
26
|
export const getStaticProps: GetStaticProps = (context) => {
|
|
38
|
-
|
|
39
|
-
const
|
|
27
|
+
const { slug } = context.params as { slug: string[] };
|
|
28
|
+
const dirParts = slug.slice(0, -1);
|
|
29
|
+
const file = slug[slug.length - 1];
|
|
30
|
+
const docPath = dirParts.length > 0 ? `docs/${dirParts.join('/')}/` : 'docs/';
|
|
31
|
+
const sectionId = `/${slug[0]}`;
|
|
32
|
+
|
|
40
33
|
return {
|
|
41
34
|
props: {
|
|
42
|
-
...fetchDocPageMarkdown(
|
|
35
|
+
...fetchDocPageMarkdown(docPath, file, sectionId).props,
|
|
43
36
|
config: getClientRuntimeConfig(),
|
|
44
37
|
},
|
|
45
38
|
};
|
|
46
39
|
};
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
* @returns
|
|
52
|
-
*/
|
|
53
|
-
export default function DocPage({ content, menu, metadata, current, config }: DocumentationProps) {
|
|
41
|
+
export default function DocCatchAllPage({ content, menu, metadata, current, config }: DocumentationProps) {
|
|
42
|
+
const bodyRef = useRef<HTMLDivElement>(null);
|
|
43
|
+
|
|
54
44
|
if (content) {
|
|
55
45
|
return (
|
|
56
46
|
<Layout config={config} menu={menu} current={current} metadata={metadata}>
|
|
@@ -58,12 +48,15 @@ export default function DocPage({ content, menu, metadata, current, config }: Do
|
|
|
58
48
|
<HeadersType.H1>{metadata.title}</HeadersType.H1>
|
|
59
49
|
<p className="text-lg leading-relaxed text-gray-600 dark:text-gray-300">{metadata.description}</p>
|
|
60
50
|
</div>
|
|
61
|
-
<div>
|
|
62
|
-
<div className="
|
|
63
|
-
<
|
|
64
|
-
{
|
|
65
|
-
|
|
51
|
+
<div className="lg:gap-10 lg:py-8 xl:grid xl:grid-cols-[1fr_280px]">
|
|
52
|
+
<div className="min-w-0">
|
|
53
|
+
<div className="prose mb-10" ref={bodyRef}>
|
|
54
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
55
|
+
{content}
|
|
56
|
+
</ReactMarkdown>
|
|
57
|
+
</div>
|
|
66
58
|
</div>
|
|
59
|
+
<PageTOC body={bodyRef} title="On This Page" />
|
|
67
60
|
</div>
|
|
68
61
|
</Layout>
|
|
69
62
|
);
|
|
@@ -7,8 +7,9 @@ import path from 'path';
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import ReactMarkdown from 'react-markdown';
|
|
9
9
|
import rehypeRaw from 'rehype-raw';
|
|
10
|
+
import remarkGfm from 'remark-gfm';
|
|
10
11
|
import Footer from '../../components/Footer';
|
|
11
|
-
import { MarkdownComponents } from '../../components/Markdown/MarkdownComponents';
|
|
12
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
12
13
|
import Header from '../../components/old/Header';
|
|
13
14
|
import { fetchDocPageMarkdown, FontDocumentationProps, getClientRuntimeConfig, getTokens } from '../../components/util';
|
|
14
15
|
|
|
@@ -92,7 +93,7 @@ const FontsPage = ({ content, menu, metadata, current, customFonts, design, conf
|
|
|
92
93
|
))}
|
|
93
94
|
|
|
94
95
|
<div className="prose">
|
|
95
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
96
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
96
97
|
{content}
|
|
97
98
|
</ReactMarkdown>
|
|
98
99
|
</div>
|
|
@@ -3,8 +3,9 @@ import type { GetStaticProps } from 'next';
|
|
|
3
3
|
import Head from 'next/head';
|
|
4
4
|
import ReactMarkdown from 'react-markdown';
|
|
5
5
|
import rehypeRaw from 'rehype-raw';
|
|
6
|
+
import remarkGfm from 'remark-gfm';
|
|
6
7
|
import Footer from '../../components/Footer';
|
|
7
|
-
import { MarkdownComponents } from '../../components/Markdown/MarkdownComponents';
|
|
8
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
8
9
|
import NavLink from '../../components/NavLink';
|
|
9
10
|
import Header from '../../components/old/Header';
|
|
10
11
|
import { DocumentationProps, fetchDocPageMarkdown, getClientRuntimeConfig } from '../../components/util';
|
|
@@ -77,7 +78,7 @@ const AssetsPage = ({ content, menu, metadata, current, config }: DocumentationP
|
|
|
77
78
|
</div>
|
|
78
79
|
|
|
79
80
|
<div className="prose">
|
|
80
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
81
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
81
82
|
{content}
|
|
82
83
|
</ReactMarkdown>
|
|
83
84
|
</div>
|
|
@@ -3,8 +3,9 @@ import type { GetStaticProps } from 'next';
|
|
|
3
3
|
import Head from 'next/head';
|
|
4
4
|
import ReactMarkdown from 'react-markdown';
|
|
5
5
|
import rehypeRaw from 'rehype-raw';
|
|
6
|
+
import remarkGfm from 'remark-gfm';
|
|
6
7
|
import Footer from '../../components/Footer';
|
|
7
|
-
import { MarkdownComponents } from '../../components/Markdown/MarkdownComponents';
|
|
8
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
8
9
|
import Header from '../../components/old/Header';
|
|
9
10
|
import { DocumentationProps, fetchDocPageMarkdown, getClientRuntimeConfig } from '../../components/util';
|
|
10
11
|
|
|
@@ -57,7 +58,7 @@ const AssetsLogosPage = ({ content, menu, metadata, current, config }: Documenta
|
|
|
57
58
|
</div>
|
|
58
59
|
</div>
|
|
59
60
|
<div className="prose">
|
|
60
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
61
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
61
62
|
{content}
|
|
62
63
|
</ReactMarkdown>
|
|
63
64
|
</div>
|
|
@@ -3,10 +3,11 @@ import upperFirst from 'lodash/upperFirst';
|
|
|
3
3
|
import type { GetStaticProps } from 'next';
|
|
4
4
|
import ReactMarkdown from 'react-markdown';
|
|
5
5
|
import rehypeRaw from 'rehype-raw';
|
|
6
|
+
import remarkGfm from 'remark-gfm';
|
|
6
7
|
import ColorGrid from '../..//components/Foundations/ColorGrid';
|
|
7
8
|
import { DownloadTokens } from '../../components/DownloadTokens';
|
|
8
9
|
import Layout from '../../components/Layout/Main';
|
|
9
|
-
import { MarkdownComponents } from '../../components/Markdown/MarkdownComponents';
|
|
10
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
10
11
|
import AnchorNav from '../../components/Navigation/AnchorNav';
|
|
11
12
|
import PrevNextNav from '../../components/Navigation/PrevNextNav';
|
|
12
13
|
import HeadersType from '../../components/Typography/Headers';
|
|
@@ -89,7 +90,7 @@ const ColorsPage = ({
|
|
|
89
90
|
/>
|
|
90
91
|
|
|
91
92
|
<div className="prose">
|
|
92
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
93
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
93
94
|
{content}
|
|
94
95
|
</ReactMarkdown>
|
|
95
96
|
</div>
|
|
@@ -6,9 +6,10 @@ import type { GetStaticProps } from 'next';
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import ReactMarkdown from 'react-markdown';
|
|
8
8
|
import rehypeRaw from 'rehype-raw';
|
|
9
|
+
import remarkGfm from 'remark-gfm';
|
|
9
10
|
import { DownloadTokens } from '../../components/DownloadTokens';
|
|
10
11
|
import Layout from '../../components/Layout/Main';
|
|
11
|
-
import { MarkdownComponents } from '../../components/Markdown/MarkdownComponents';
|
|
12
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
12
13
|
import AnchorNav from '../../components/Navigation/AnchorNav';
|
|
13
14
|
import HeadersType from '../../components/Typography/Headers';
|
|
14
15
|
import * as util from '../../components/util';
|
|
@@ -128,7 +129,7 @@ const EffectsPage = ({
|
|
|
128
129
|
/>
|
|
129
130
|
|
|
130
131
|
<div className="prose">
|
|
131
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
132
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
132
133
|
{content}
|
|
133
134
|
</ReactMarkdown>
|
|
134
135
|
</div>
|
|
@@ -5,9 +5,10 @@ import Link from 'next/link';
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import ReactMarkdown from 'react-markdown';
|
|
7
7
|
import rehypeRaw from 'rehype-raw';
|
|
8
|
+
import remarkGfm from 'remark-gfm';
|
|
8
9
|
import Footer from '../../../components/Footer';
|
|
9
10
|
import Layout from '../../../components/Layout/Main';
|
|
10
|
-
import { MarkdownComponents } from '../../../components/Markdown/MarkdownComponents';
|
|
11
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../../components/Markdown/MarkdownComponents';
|
|
11
12
|
import HeadersType from '../../../components/Typography/Headers';
|
|
12
13
|
import { buttonVariants } from '../../../components/ui/button';
|
|
13
14
|
import { Input } from '../../../components/ui/input';
|
|
@@ -99,7 +100,7 @@ const IconsPage = ({ content, menu, metadata, current, config, assets }: AssetDo
|
|
|
99
100
|
</div>
|
|
100
101
|
<hr className="mb-10" />
|
|
101
102
|
<div className="prose">
|
|
102
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
103
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
103
104
|
{content}
|
|
104
105
|
</ReactMarkdown>
|
|
105
106
|
</div>
|
|
@@ -2,9 +2,10 @@ import { Hexagon, LayoutPanelLeft, Palette, Shapes, Sun, TypeOutline } from 'luc
|
|
|
2
2
|
import type { GetStaticProps } from 'next';
|
|
3
3
|
import ReactMarkdown from 'react-markdown';
|
|
4
4
|
import rehypeRaw from 'rehype-raw';
|
|
5
|
+
import remarkGfm from 'remark-gfm';
|
|
5
6
|
import CardsWithIcons from '../../components/cards/CardsWithIcons';
|
|
6
7
|
import Layout from '../../components/Layout/Main';
|
|
7
|
-
import { MarkdownComponents } from '../../components/Markdown/MarkdownComponents';
|
|
8
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
8
9
|
import HeadersType from '../../components/Typography/Headers';
|
|
9
10
|
import { DocumentationProps, fetchDocPageMarkdown, getClientRuntimeConfig } from '../../components/util';
|
|
10
11
|
|
|
@@ -33,7 +34,7 @@ const DesignPage = ({ content, menu, metadata, current, config }: DocumentationP
|
|
|
33
34
|
<p className="text-lg leading-relaxed text-gray-600 dark:text-gray-300">{metadata.description}</p>
|
|
34
35
|
</div>
|
|
35
36
|
<div className="prose">
|
|
36
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
37
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
37
38
|
{content}
|
|
38
39
|
</ReactMarkdown>
|
|
39
40
|
</div>
|
|
@@ -6,9 +6,10 @@ import { AssetDocumentationProps, fetchDocPageMarkdown, getClientRuntimeConfig,
|
|
|
6
6
|
import { Download } from 'lucide-react';
|
|
7
7
|
import ReactMarkdown from 'react-markdown';
|
|
8
8
|
import rehypeRaw from 'rehype-raw';
|
|
9
|
+
import remarkGfm from 'remark-gfm';
|
|
9
10
|
import { DisplayLogo } from '../../components/Foundations/DisplayLogo';
|
|
10
11
|
import Layout from '../../components/Layout/Main';
|
|
11
|
-
import { MarkdownComponents } from '../../components/Markdown/MarkdownComponents';
|
|
12
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
12
13
|
import HeadersType from '../../components/Typography/Headers';
|
|
13
14
|
import { buttonVariants } from '../../components/ui/button';
|
|
14
15
|
|
|
@@ -73,7 +74,7 @@ const LogoPage = ({ content, menu, metadata, current, config, assets }: AssetDoc
|
|
|
73
74
|
<hr />
|
|
74
75
|
<hr />
|
|
75
76
|
<div className="prose">
|
|
76
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
77
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
77
78
|
{content}
|
|
78
79
|
</ReactMarkdown>
|
|
79
80
|
</div>
|
|
@@ -3,10 +3,11 @@ import sortedUniq from 'lodash/sortedUniq';
|
|
|
3
3
|
import type * as next from 'next';
|
|
4
4
|
import ReactMarkdown from 'react-markdown';
|
|
5
5
|
import rehypeRaw from 'rehype-raw';
|
|
6
|
+
import remarkGfm from 'remark-gfm';
|
|
6
7
|
import { DownloadTokens } from '../../components/DownloadTokens';
|
|
7
8
|
import TypographyExamples from '../../components/Foundations/TypographyExample';
|
|
8
9
|
import Layout from '../../components/Layout/Main';
|
|
9
|
-
import { MarkdownComponents } from '../../components/Markdown/MarkdownComponents';
|
|
10
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
10
11
|
import AnchorNav, { anchorSlugify } from '../../components/Navigation/AnchorNav';
|
|
11
12
|
import HeadersType from '../../components/Typography/Headers';
|
|
12
13
|
import { fetchFoundationDocPageMarkdown, FoundationDocumentationProps, getClientRuntimeConfig, getTokens } from '../../components/util';
|
|
@@ -124,7 +125,7 @@ const Typography = ({
|
|
|
124
125
|
/>
|
|
125
126
|
|
|
126
127
|
<div className="prose">
|
|
127
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
128
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
128
129
|
{content}
|
|
129
130
|
</ReactMarkdown>
|
|
130
131
|
</div>
|
package/src/app/pages/index.tsx
CHANGED
|
@@ -5,9 +5,10 @@ import Link from 'next/link';
|
|
|
5
5
|
import { useRouter } from 'next/router';
|
|
6
6
|
import ReactMarkdown from 'react-markdown';
|
|
7
7
|
import rehypeRaw from 'rehype-raw';
|
|
8
|
+
import remarkGfm from 'remark-gfm';
|
|
8
9
|
import Footer from '../components/Footer';
|
|
9
10
|
import Layout from '../components/Layout/Main';
|
|
10
|
-
import { MarkdownComponents } from '../components/Markdown/MarkdownComponents';
|
|
11
|
+
import { MarkdownComponents, remarkCodeMeta } from '../components/Markdown/MarkdownComponents';
|
|
11
12
|
import HeadersType from '../components/Typography/Headers';
|
|
12
13
|
import { Button } from '../components/ui/button';
|
|
13
14
|
import { DocumentationProps, fetchDocPageMarkdown, getClientRuntimeConfig } from '../components/util';
|
|
@@ -41,7 +42,7 @@ const Home = ({ content, menu, metadata, config, current }: DocumentationProps)
|
|
|
41
42
|
</HeadersType.H1>
|
|
42
43
|
{content && (
|
|
43
44
|
<div className="text-lg max-w-4xl empty:hidden [&>*]:mt-6 [&>p]:font-light [&>h2:first-child]:mt-0 [&>h2:first-child]:font-normal sm:text-xl">
|
|
44
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
45
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
45
46
|
{content}
|
|
46
47
|
</ReactMarkdown>
|
|
47
48
|
</div>
|
|
@@ -6,11 +6,12 @@ import { startCase } from 'lodash';
|
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
7
|
import ReactMarkdown from 'react-markdown';
|
|
8
8
|
import rehypeRaw from 'rehype-raw';
|
|
9
|
+
import remarkGfm from 'remark-gfm';
|
|
9
10
|
import { ComponentPreview } from '../../../../components/Component/Preview';
|
|
10
11
|
import { HotReloadProvider } from '../../../../components/context/HotReloadProvider';
|
|
11
12
|
import { PreviewContextProvider } from '../../../../components/context/PreviewContext';
|
|
12
13
|
import Layout from '../../../../components/Layout/Main';
|
|
13
|
-
import { MarkdownComponents } from '../../../../components/Markdown/MarkdownComponents';
|
|
14
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../../../components/Markdown/MarkdownComponents';
|
|
14
15
|
import AnchorNav from '../../../../components/Navigation/AnchorNav';
|
|
15
16
|
import PrevNextNav from '../../../../components/Navigation/PrevNextNav';
|
|
16
17
|
import HeadersType from '../../../../components/Typography/Headers';
|
|
@@ -172,7 +173,7 @@ const GenericComponentPage = ({ menu, metadata, current, id, config, componentHo
|
|
|
172
173
|
<HeadersType.H1>{metadata.title}</HeadersType.H1>
|
|
173
174
|
<div className="flex flex-row justify-between gap-4 md:flex-col">
|
|
174
175
|
<div className="prose max-w-[800px] text-xl font-light leading-relaxed text-gray-600 dark:text-gray-300">
|
|
175
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
176
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
176
177
|
{metadata.description}
|
|
177
178
|
</ReactMarkdown>
|
|
178
179
|
</div>
|
|
@@ -5,9 +5,10 @@ import Image from 'next/image';
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
import ReactMarkdown from 'react-markdown';
|
|
7
7
|
import rehypeRaw from 'rehype-raw';
|
|
8
|
+
import remarkGfm from 'remark-gfm';
|
|
8
9
|
import { APIComponentList } from '../../components/Component/ComponentLists';
|
|
9
10
|
import Layout from '../../components/Layout/Main';
|
|
10
|
-
import { MarkdownComponents } from '../../components/Markdown/MarkdownComponents';
|
|
11
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../components/Markdown/MarkdownComponents';
|
|
11
12
|
import HeadersType from '../../components/Typography/Headers';
|
|
12
13
|
import { Button } from '../../components/ui/button';
|
|
13
14
|
import { Drawer, DrawerContent, DrawerHeader, DrawerTitle, DrawerTrigger } from '../../components/ui/drawer';
|
|
@@ -127,7 +128,7 @@ const ComponentsPage = ({ content, menu, metadata, current, config }: ComponentP
|
|
|
127
128
|
</div>
|
|
128
129
|
<div>
|
|
129
130
|
<div className="prose mb-10">
|
|
130
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
131
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
131
132
|
{content}
|
|
132
133
|
</ReactMarkdown>
|
|
133
134
|
</div>
|
|
@@ -3,8 +3,9 @@ import { groupBy, upperFirst } from 'lodash';
|
|
|
3
3
|
import type { GetStaticProps } from 'next';
|
|
4
4
|
import ReactMarkdown from 'react-markdown';
|
|
5
5
|
import rehypeRaw from 'rehype-raw';
|
|
6
|
+
import remarkGfm from 'remark-gfm';
|
|
6
7
|
import Layout from '../../../../components/Layout/Main';
|
|
7
|
-
import { MarkdownComponents } from '../../../../components/Markdown/MarkdownComponents';
|
|
8
|
+
import { MarkdownComponents, remarkCodeMeta } from '../../../../components/Markdown/MarkdownComponents';
|
|
8
9
|
import AnchorNav from '../../../../components/Navigation/AnchorNav';
|
|
9
10
|
import HeadersType from '../../../../components/Typography/Headers';
|
|
10
11
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../../../../components/ui/table';
|
|
@@ -67,7 +68,7 @@ const ComponentsPage = ({ content, menu, metadata, current, config, design }: Fo
|
|
|
67
68
|
<div className="mt-10 lg:gap-10 lg:py-8 xl:grid xl:grid-cols-[1fr_280px]">
|
|
68
69
|
<div>
|
|
69
70
|
<div className="prose">
|
|
70
|
-
<ReactMarkdown components={MarkdownComponents} rehypePlugins={[rehypeRaw]}>
|
|
71
|
+
<ReactMarkdown components={MarkdownComponents} remarkPlugins={[remarkGfm, remarkCodeMeta]} rehypePlugins={[rehypeRaw]}>
|
|
71
72
|
{content}
|
|
72
73
|
</ReactMarkdown>
|
|
73
74
|
</div>
|