Skip to content

Commit

Permalink
fix: prose code props type
Browse files Browse the repository at this point in the history
Signed-off-by: ZTL-UwU <[email protected]>
  • Loading branch information
ZTL-UwU committed Nov 20, 2024
1 parent b640fb2 commit 2df5136
Showing 1 changed file with 21 additions and 32 deletions.
53 changes: 21 additions & 32 deletions components/content/ProseCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,41 +37,30 @@
import type { BuiltinLanguage } from 'shiki';
import ScrollBar from '../ui/scroll-area/ScrollBar.vue';
const props = defineProps({
code: {
type: String,
default: '',
},
language: {
type: String as PropType<BuiltinLanguage>,
default: null,
},
filename: {
type: String,
default: null,
},
inGroup: {
type: Boolean,
default: false,
},
inStack: {
type: Boolean,
default: false,
},
highlights: {
type: Array as () => number[],
default: () => [],
},
meta: {
type: String,
default: null,
},
});
const {
code = '',
inGroup = false,
inStack = false,
language,
filename,
meta,
} = defineProps<{
code?: string;
language?: BuiltinLanguage;
filename?: string;
inGroup?: boolean;
inStack?: boolean;
highlights?: number[];
meta?: string;
}>();
const showLineNumber = computed(() => props.meta.includes('line-numbers'));
const showLineNumber = computed(() => meta?.includes('line-numbers'));
const iconMap = new Map(Object.entries(useConfig().value.main.codeIcon));
const icon = iconMap.get(props.filename?.toLowerCase()) || iconMap.get(props.language);
const icon = computed(() => {
const filenameLow = filename?.toLowerCase();
return (filenameLow && iconMap.get(filenameLow)) || (language && iconMap.get(language));
});
</script>

<style>
Expand Down

0 comments on commit 2df5136

Please sign in to comment.