2
2
3
3
[ ![ NPM version] ( https://img.shields.io/npm/v/vuejs-code-block.svg )] ( https://www.npmjs.com/package/vuejs-code-block )
4
4
5
- Documentation: [ https://vuejs-code-block.netlify.app/ ] ( https://vuejs-code-block.netlify.app/ )
5
+ <div align =" center " >
6
+ <a href =" https://hetari.github.io/vuejs-code-block/ " >
7
+ <img src="./docs/public/logo.webp" width="250" />
8
+ </a >
9
+ </div >
6
10
7
11
> [ !IMPORTANT]
8
12
> For now this package has default themes, but in the future, it will be fully unstyled, allowing you to style it however you like.
@@ -28,23 +32,22 @@ Once installed, you can start using the `CodeBlock` component in your `Vue 3` ap
28
32
``` vue ts:line-numbers {1}
29
33
<template>
30
34
<CodeBlock
31
- theme="dark"
32
- :code="codeExample"
33
- language="javascript"
34
- class="custom-class"
35
- id="example-code-block" />
35
+ :code="code"
36
+ :numbered="true"
37
+ :show-header="true"
38
+ file-name="codeBlock.ts"
39
+ language="ts"
40
+ theme="dracula">
41
+ </CodeBlock>
36
42
</template>
37
43
38
44
<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
- `;
45
+ import { CodeBlock } from './components/code-block';
46
+ const code = `const name = 'Vuejs Code Block';
47
+ const usrls = {
48
+ github: 'https://github.com/hetari/vuejs-code-block',
49
+ docs: 'https://hetari.github.io/vuejs-code-block/'
50
+ };`;
48
51
</script>
49
52
```
50
53
@@ -82,13 +85,15 @@ greet('World');
82
85
83
86
## Props:
84
87
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 ` . |
88
+ | Prop | Type | Required | Default | Description |
89
+ | ------------ | --------- | -------- | ------- | ------------------------------------------------------------------------------------------ |
90
+ | ` code ` | ` string ` | Yes | N/A | The code you want to display, passed as a string. |
91
+ | ` language ` | ` string ` | Yes | N/A | Specifies the programming language for syntax highlighting. |
92
+ | ` theme ` | ` string ` | Yes | N/A | Specifies the theme to be used for syntax highlighting (light or dark). |
93
+ | ` asElement ` | ` string ` | No | ` <pre >` | Defines the HTML element wrapping the code block (defaults to ` <pre >` ). |
94
+ | ` numbered ` | ` boolean ` | No | ` false ` | Displays line numbers when set to ` true ` . |
95
+ | ` showHeader ` | ` boolean ` | No | ` true ` | Displays the code block header (title, language icon, and copy button) when set to ` true ` . |
96
+ | ` file - name ` | ` string ` | No | N/A | The name of the file to be displayed in the header. |
92
97
93
98
<!-- ## Custom Styling
94
99
0 commit comments