@@ -28,23 +28,22 @@ Once installed, you can start using the `CodeBlock` component in your `Vue 3` ap
28
28
``` vue ts:line-numbers {1}
29
29
<template>
30
30
<CodeBlock
31
- theme="dark"
32
- :code="codeExample"
33
- language="javascript"
34
- class="custom-class"
35
- id="example-code-block" />
31
+ :code="code"
32
+ :numbered="true"
33
+ :show-header="true"
34
+ file-name="codeBlock.ts"
35
+ language="ts"
36
+ theme="dracula">
37
+ </CodeBlock>
36
38
</template>
37
39
38
40
<script setup lang="ts">
39
- import { CodeBlock } from 'vuejs-code-block';
40
-
41
- const codeExample = `
42
- function greet(name) {
43
- console.log('Hello, ' + name);
44
- }
45
-
46
- greet('World');
47
- `;
41
+ import { CodeBlock } from './components/code-block';
42
+ const code = `const name = 'Vuejs Code Block';
43
+ const usrls = {
44
+ github: 'https://github.com/hetari/vuejs-code-block',
45
+ docs: 'https://hetari.github.io/vuejs-code-block/'
46
+ };`;
48
47
</script>
49
48
```
50
49
@@ -82,13 +81,15 @@ greet('World');
82
81
83
82
## Props:
84
83
85
- | Prop | Type | Required | Default | Description |
86
- | ----------- | --------- | -------- | ------- | ----------------------------------------------------------------------- |
87
- | ` code ` | ` string ` | Yes | N/A | The code you want to display, passed as a string. |
88
- | ` language ` | ` string ` | Yes | N/A | Specifies the programming language for syntax highlighting. |
89
- | ` theme ` | ` string ` | Yes | N/A | Specifies the theme to be used for syntax highlighting (light or dark). |
90
- | ` asElement ` | ` string ` | No | ` <pre >` | Defines the HTML element wrapping the code block (defaults to ` <pre >` ). |
91
- | ` numbered ` | ` boolean ` | No | ` false ` | Displays line numbers when set to ` true ` . |
84
+ | Prop | Type | Required | Default | Description |
85
+ | ------------ | --------- | -------- | ------- | ------------------------------------------------------------------------------------------ |
86
+ | ` code ` | ` string ` | Yes | N/A | The code you want to display, passed as a string. |
87
+ | ` language ` | ` string ` | Yes | N/A | Specifies the programming language for syntax highlighting. |
88
+ | ` theme ` | ` string ` | Yes | N/A | Specifies the theme to be used for syntax highlighting (light or dark). |
89
+ | ` asElement ` | ` string ` | No | ` <pre >` | Defines the HTML element wrapping the code block (defaults to ` <pre >` ). |
90
+ | ` numbered ` | ` boolean ` | No | ` false ` | Displays line numbers when set to ` true ` . |
91
+ | ` showHeader ` | ` boolean ` | No | ` true ` | Displays the code block header (title, language icon, and copy button) when set to ` true ` . |
92
+ | ` file - name ` | ` string ` | No | N/A | The name of the file to be displayed in the header. |
92
93
93
94
<!-- ## Custom Styling
94
95
0 commit comments