Skip to content

Commit

Permalink
feat: code block icon
Browse files Browse the repository at this point in the history
Signed-off-by: ZTL-UwU <[email protected]>
  • Loading branch information
ZTL-UwU committed May 25, 2024
1 parent a26254a commit 115bf3d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
41 changes: 41 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,47 @@ export default defineAppConfig({
main: {
breadCrumb: true,
showTitle: true,
codeIcon: {
'package.json': 'vscode-icons:file-type-node',
'tsconfig.json': 'vscode-icons:file-type-tsconfig',
'.npmrc': 'vscode-icons:file-type-npm',
'.editorconfig': 'vscode-icons:file-type-editorconfig',
'.eslintrc': 'vscode-icons:file-type-eslint',
'.eslintrc.cjs': 'vscode-icons:file-type-eslint',
'.eslintignore': 'vscode-icons:file-type-eslint',
'eslint.config.js': 'vscode-icons:file-type-eslint',
'eslint.config.mjs': 'vscode-icons:file-type-eslint',
'eslint.config.cjs': 'vscode-icons:file-type-eslint',
'.gitignore': 'vscode-icons:file-type-git',
'yarn.lock': 'vscode-icons:file-type-yarn',
'.env': 'vscode-icons:file-type-dotenv',
'.env.example': 'vscode-icons:file-type-dotenv',
'.vscode/settings.json': 'vscode-icons:file-type-vscode',
'nuxt': 'vscode-icons:file-type-nuxt',
'.nuxtrc': 'vscode-icons:file-type-nuxt',
'.nuxtignore': 'vscode-icons:file-type-nuxt',
'nuxt.config.js': 'vscode-icons:file-type-nuxt',
'nuxt.config.ts': 'vscode-icons:file-type-nuxt',
'nuxt.schema.ts': 'vscode-icons:file-type-nuxt',
'tailwind.config.js': 'vscode-icons:file-type-tailwind',
'tailwind.config.ts': 'vscode-icons:file-type-tailwind',
'vue': 'vscode-icons:file-type-vue',
'ts': 'vscode-icons:file-type-typescript',
'tsx': 'vscode-icons:file-type-typescript',
'mjs': 'vscode-icons:file-type-js',
'cjs': 'vscode-icons:file-type-js',
'js': 'vscode-icons:file-type-js',
'jsx': 'vscode-icons:file-type-js',
'md': 'vscode-icons:file-type-markdown',
'py': 'vscode-icons:file-type-python',
'npm': 'vscode-icons:file-type-npm',
'pnpm': 'vscode-icons:file-type-pnpm',
'npx': 'vscode-icons:file-type-npm',
'yarn': 'vscode-icons:file-type-yarn',
'bun': 'vscode-icons:file-type-bun',
'yml': 'vscode-icons:file-type-yaml',
'terminal': 'lucide:terminal',
},
},
footer: {
credits: 'Copyright © 2024',
Expand Down
Binary file modified bun.lockb
Binary file not shown.
4 changes: 4 additions & 0 deletions components/content/ProseCode.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<UiCard class="[&:not(:first-child)]:mt-5 mb-5 overflow-hidden">
<div v-if="filename" class="p-3 border-b flex text-sm font-mono">
<Icon v-if="icon" :name="icon" class="self-center mr-1.5" />
{{ filename }}
<span class="ml-auto mr-1">
<Transition name="fade" mode="out-in">
Expand Down Expand Up @@ -84,6 +85,9 @@ const checkIconRef = ref<HTMLElement>();
onClickOutside(checkIconRef, () => {
copied.value = false;
});
const iconMap = new Map(Object.entries(useConfig().value.main.codeIcon));
const icon = iconMap.get(props.filename?.toLowerCase()) || iconMap.get(props.language);
</script>

<style>
Expand Down
4 changes: 4 additions & 0 deletions content/1.getting-started/1.aaa/1.aaa.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export default defineAppConfig({
});
```

```[as]
sdadsa
```

### Footer

```ts [app.config.ts]
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"devDependencies": {
"@antfu/eslint-config": "^2.18.1",
"@iconify-json/lucide": "^1.1.187",
"@iconify-json/vscode-icons": "^1.1.34",
"@vueuse/core": "^10.9.0",
"@vueuse/nuxt": "^10.9.0",
"eslint": "9.2.0",
Expand Down

0 comments on commit 115bf3d

Please sign in to comment.