UI: Support inline code & nested list

This commit is contained in:
fuma-nama
2024-09-01 00:05:02 +08:00
parent b45f0ea022
commit 0c251e52ca
26 changed files with 836 additions and 752 deletions
+14
View File
@@ -0,0 +1,14 @@
---
'@fumadocs/content-collections': patch
'fumadocs-core': patch
'create-fumadocs-app': patch
'fumadocs-docgen': patch
'fumadocs-mdx': patch
'@fumadocs/mdx-remote': patch
'fumadocs-openapi': patch
'fumadocs-twoslash': patch
'fumadocs-typescript': patch
'fumadocs-ui': patch
---
Bump deps
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-ui': patch
---
Support Shiki inline code
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-ui': patch
---
Improve nested list styles
@@ -41,6 +41,12 @@ console.log('Hello');
You may filter the meta string before processing it with the `filterMetaString` option.
### Inline Code
`console.log("hello world"){:js}` works.
See https://shiki.style/packages/rehype#inline-code.
### Icon
Add an icon according to the language of codeblock.
+11 -11
View File
@@ -14,11 +14,11 @@
"start": "next start"
},
"dependencies": {
"@next/env": "^14.2.5",
"@next/env": "^14.2.7",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-tooltip": "^1.1.2",
"@resvg/resvg-js": "^2.6.2",
"@shikijs/transformers": "^1.13.0",
"@shikijs/transformers": "^1.15.1",
"algoliasearch": "^4.24.0",
"class-variance-authority": "^0.7.0",
"fumadocs-core": "workspace:*",
@@ -30,24 +30,24 @@
"fumadocs-ui": "workspace:*",
"geist": "^1.3.1",
"katex": "^0.16.11",
"lucide-react": "^0.428.0",
"next": "^14.2.5",
"lucide-react": "^0.437.0",
"next": "^14.2.7",
"phenomenon": "^1.6.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rehype-katex": "^7.0.0",
"rehype-katex": "^7.0.1",
"remark-math": "^6.0.0",
"satori": "^0.10.14",
"shiki": "^1.13.0",
"shiki": "^1.15.1",
"tailwind-merge": "^2.5.2",
"zod": "^3.23.8"
},
"devDependencies": {
"@next/bundle-analyzer": "^14.2.5",
"@next/eslint-plugin-next": "^14.2.5",
"@next/bundle-analyzer": "^14.2.7",
"@next/eslint-plugin-next": "^14.2.7",
"@types/mdx": "^2.0.13",
"@types/node": "22.3.0",
"@types/react": "^18.3.3",
"@types/node": "22.5.1",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"autoprefixer": "^10.4.20",
"eslint-config-custom": "workspace:*",
@@ -57,7 +57,7 @@
"tailwindcss": "^3.4.10",
"tailwindcss-animate": "^1.0.7",
"tsconfig": "workspace:*",
"tsx": "^4.17.0",
"tsx": "^4.19.0",
"typescript": "^5.5.4",
"webpack": "^5.90.3"
}
+1
View File
@@ -44,6 +44,7 @@ export default defineConfig({
lastModifiedTime: 'git',
mdxOptions: {
rehypeCodeOptions: {
inline: 'tailing-curly-colon',
themes: {
light: 'catppuccin-latte',
dark: 'catppuccin-mocha',
+2 -2
View File
@@ -11,7 +11,7 @@
"@fumadocs/content-collections": "workspace:*",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "^14.2.5",
"next": "^14.2.7",
"react": "18.3.1",
"react-dom": "18.3.1"
},
@@ -20,7 +20,7 @@
"@content-collections/mdx": "^0.1.3",
"@content-collections/next": "^0.2.0",
"@types/mdx": "^2.0.13",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"typescript": "^5.5.4"
}
+2 -2
View File
@@ -11,13 +11,13 @@
"fumadocs-core": "workspace:*",
"fumadocs-mdx": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "^14.2.5",
"next": "^14.2.7",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"typescript": "^5.5.4"
}
+2 -2
View File
@@ -12,7 +12,7 @@
"fumadocs-mdx": "workspace:*",
"fumadocs-ui": "workspace:*",
"hast-util-to-jsx-runtime": "^2.3.0",
"next": "^14.2.5",
"next": "^14.2.7",
"react": "18.3.1",
"react-dom": "18.3.1",
"remark": "^15.0.0",
@@ -21,7 +21,7 @@
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"typescript": "^5.5.4"
}
+2 -2
View File
@@ -13,7 +13,7 @@
"fumadocs-mdx": "workspace:*",
"fumadocs-openapi": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "^14.2.5",
"next": "^14.2.7",
"postcss": "^8.4.41",
"react": "18.3.1",
"react-dom": "18.3.1",
@@ -22,7 +22,7 @@
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"rimraf": "^6.0.1",
"typescript": "^5.5.4"
+2 -2
View File
@@ -11,13 +11,13 @@
"@fumadocs/mdx-remote": "workspace:*",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "^14.2.5",
"next": "^14.2.7",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"typescript": "^5.5.4"
}
+2 -2
View File
@@ -19,8 +19,8 @@
"prettier": "@vercel/style-guide/prettier",
"devDependencies": {
"@changesets/cli": "^2.27.7",
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"@vercel/style-guide": "^6.0.0",
"concurrently": "^8.2.2",
"eslint": "^8.57.0",
+1 -1
View File
@@ -47,7 +47,7 @@
"devDependencies": {
"@content-collections/core": "^0.6.4",
"@content-collections/mdx": "^0.1.3",
"@types/node": "22.3.0",
"@types/node": "22.5.1",
"eslint-config-custom": "workspace:*",
"fumadocs-core": "workspace:*",
"tsconfig": "workspace:*",
+6 -6
View File
@@ -134,8 +134,8 @@
},
"dependencies": {
"@formatjs/intl-localematcher": "^0.5.4",
"@shikijs/rehype": "^1.13.0",
"@shikijs/transformers": "^1.13.0",
"@shikijs/rehype": "^1.15.1",
"@shikijs/transformers": "^1.15.1",
"flexsearch": "0.7.21",
"github-slugger": "^2.0.0",
"image-size": "^1.1.1",
@@ -146,7 +146,7 @@
"remark-gfm": "^4.0.0",
"remark-mdx": "^3.0.1",
"scroll-into-view-if-needed": "^3.1.0",
"shiki": "^1.13.0",
"shiki": "^1.15.1",
"swr": "^2.2.5",
"unist-util-visit": "^5.0.0"
},
@@ -158,12 +158,12 @@
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.3",
"@types/negotiator": "^0.6.3",
"@types/node": "22.3.0",
"@types/react": "^18.3.3",
"@types/node": "22.5.1",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"algoliasearch": "^4.24.0",
"eslint-config-custom": "workspace:*",
"next": "^14.2.5",
"next": "^14.2.7",
"tsconfig": "workspace:*",
"unified": "^11.0.5"
},
+3 -3
View File
@@ -9,11 +9,11 @@
"@content-collections/mdx": "^0.1.3",
"@content-collections/next": "^0.2.0",
"@types/mdx": "^2.0.13",
"@types/node": "22.3.0",
"@types/react": "^18.3.3",
"@types/node": "22.5.1",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"autoprefixer": "^10.4.20",
"next": "^14.2.5",
"next": "^14.2.7",
"postcss": "^8.4.41",
"react": "^18.3.1",
"react-dom": "^18.3.1",
+1 -1
View File
@@ -33,7 +33,7 @@
},
"devDependencies": {
"@types/cross-spawn": "^6.0.6",
"@types/node": "22.3.0",
"@types/node": "22.5.1",
"eslint-config-custom": "workspace:*",
"fast-glob": "^3.3.1",
"tsconfig": "workspace:*"
+1 -1
View File
@@ -38,7 +38,7 @@
"@types/estree": "^1.0.5",
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.3",
"@types/node": "22.3.0",
"@types/node": "22.5.1",
"eslint-config-custom": "workspace:*",
"remark": "^15.0.0",
"tsconfig": "workspace:*",
+5 -5
View File
@@ -65,22 +65,22 @@
"chokidar": "^3.6.0",
"fast-glob": "^3.3.1",
"gray-matter": "^4.0.3",
"micromatch": "^4.0.7",
"micromatch": "^4.0.8",
"ws": "^8.18.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/micromatch": "^4.0.9",
"@types/node": "22.3.0",
"@types/react": "^18.3.3",
"@types/node": "22.5.1",
"@types/react": "^18.3.5",
"@types/ws": "^8.5.12",
"eslint-config-custom": "workspace:*",
"fumadocs-core": "workspace:*",
"next": "^14.2.5",
"next": "^14.2.7",
"tsconfig": "workspace:*",
"unified": "^11.0.5",
"vfile": "^6.0.2"
"vfile": "^6.0.3"
},
"peerDependencies": {
"fumadocs-core": "^13.2.1",
+3 -3
View File
@@ -58,7 +58,7 @@
"estree-util-value-to-estree": "^3.1.2",
"fast-glob": "^3.3.1",
"gray-matter": "^4.0.3",
"micromatch": "^4.0.7",
"micromatch": "^4.0.8",
"zod": "^3.23.8"
},
"devDependencies": {
@@ -66,10 +66,10 @@
"@types/mdast": "^4.0.3",
"@types/mdx": "^2.0.13",
"@types/micromatch": "^4.0.9",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"eslint-config-custom": "workspace:*",
"fumadocs-core": "workspace:*",
"next": "^14.2.5",
"next": "^14.2.7",
"tsconfig": "workspace:*",
"unified": "^11.0.5",
"webpack": "^5.90.3"
+7 -7
View File
@@ -62,22 +62,22 @@
"fumadocs-ui": "workspace:*",
"github-slugger": "^2.0.0",
"js-yaml": "^4.1.0",
"json-schema-to-typescript": "^15.0.0",
"lucide-react": "^0.428.0",
"json-schema-to-typescript": "15.0.0",
"lucide-react": "^0.437.0",
"openapi-sampler": "^1.5.1",
"react-hook-form": "^7.52.2",
"react-hook-form": "^7.53.0",
"remark": "^15.0.0",
"shiki": "^1.13.0",
"shiki": "^1.15.1",
"swr": "^2.2.5"
},
"devDependencies": {
"@types/js-yaml": "^4.0.9",
"@types/node": "22.3.0",
"@types/node": "22.5.1",
"@types/openapi-sampler": "^1.0.3",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"bunchee": "^5.3.2",
"eslint-config-custom": "workspace:*",
"next": "^14.2.5",
"next": "^14.2.7",
"openapi-types": "^12.1.3",
"tsconfig": "workspace:*"
},
+2 -2
View File
@@ -25,7 +25,7 @@
"types:check": "tsc --noEmit"
},
"dependencies": {
"@shikijs/twoslash": "^1.13.0",
"@shikijs/twoslash": "^1.15.1",
"mdast-util-from-markdown": "^2.0.1",
"mdast-util-gfm": "^3.0.0",
"mdast-util-to-hast": "^13.2.0"
@@ -35,7 +35,7 @@
"@types/mdast": "^4.0.3",
"eslint-config-custom": "workspace:*",
"fumadocs-ui": "workspace:*",
"shiki": "^1.13.0",
"shiki": "^1.15.1",
"tsconfig": "workspace:*"
},
"peerDependencies": {
+1 -1
View File
@@ -52,7 +52,7 @@
"@types/estree": "^1.0.5",
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.3",
"@types/react": "18.3.3",
"@types/react": "18.3.5",
"@types/react-dom": "18.3.0",
"eslint-config-custom": "workspace:*",
"fumadocs-ui": "workspace:*",
+6 -6
View File
@@ -113,24 +113,24 @@
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-scroll-area": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.0",
"@tailwindcss/typography": "^0.5.14",
"@tailwindcss/typography": "^0.5.15",
"class-variance-authority": "^0.7.0",
"cmdk": "^1.0.0",
"fumadocs-core": "workspace:*",
"lucide-react": "^0.428.0",
"lucide-react": "^0.437.0",
"next-themes": "^0.3.0",
"react-medium-image-zoom": "^5.2.8",
"react-medium-image-zoom": "^5.2.9",
"swr": "^2.2.5",
"tailwind-merge": "^2.5.2"
},
"devDependencies": {
"@algolia/client-search": "^4.24.0",
"@next/eslint-plugin-next": "^14.2.5",
"@types/react": "^18.3.3",
"@next/eslint-plugin-next": "^14.2.7",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"algoliasearch": "^4.24.0",
"eslint-config-custom": "workspace:*",
"next": "^14.2.5",
"next": "^14.2.7",
"postcss": "^8.4.41",
"postcss-cli": "^11.0.0",
"postcss-lightningcss": "^1.0.1",
+4 -4
View File
@@ -159,22 +159,22 @@ export const docsUi = plugin.withOptions<DocsUIOptions>(
if (css) addComponents(css);
addComponents({
'.fd-codeblock code span': {
'.shiki code span': {
color: 'var(--shiki-light)',
},
'.dark .fd-codeblock code span': {
'.dark .shiki code span': {
color: 'var(--shiki-dark)',
},
'.fd-codeblock code': {
display: 'grid',
'font-size': '13px',
},
'.fd-codeblock .highlighted': {
'.shiki .highlighted': {
margin: '0 -16px',
padding: '0 16px',
'background-color': `theme('colors.fd-primary.DEFAULT / 10%')`,
},
'.fd-codeblock .highlighted-word': {
'.shiki .highlighted-word': {
padding: '1px 2px',
margin: '-1px -3px',
border: '1px solid',
+2 -2
View File
@@ -58,10 +58,10 @@ export const typography = {
},
ul: {
listStylePosition: 'inside',
paddingLeft: '0',
paddingInlineStart: '1rem',
},
'ul > li': {
paddingLeft: '0',
paddingInlineStart: '0',
},
// Disabled styles, handled by Fumadocs UI
'pre code': false,
+740 -687
View File
File diff suppressed because it is too large Load Diff