-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support filename for code block #1027
Comments
For now you can create some component like this: <script setup lang="ts">
defineProps<{ title: string }>();
</script>
<template>
<div :style="{ '--title': `'${title}'` }">
<slot />
</div>
</template>
<style scoped>
div :deep([class*='language-']:before) {
content: var(--title);
}
</style> Then in your markdown file you can to do: <code-block title="index.ts">
```ts
console.log('hey there')
```
</code-block> |
Thanks a lot. I can use this solution as a workaround now. |
Let's track this one too on #728. I have modified its title. We'll probably be supporting something like this (#728 (comment)) directly in markdown: ```ts [index.ts]
const a: number = 1
``` So it would work with bare code blocks too. |
Is your feature request related to a problem? Please describe.
I wan't a feature to show dir/filename of current code.
Describe the solution you'd like
same as nuxt docs
may be we can add this on the top left
Describe alternatives you've considered
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: