22
33[ ![ NPM version] ( https://img.shields.io/npm/v/vuejs-code-block.svg )] ( https://www.npmjs.com/package/vuejs-code-block )
44
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 >
610
711> [ !IMPORTANT]
812> 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
2832``` vue ts:line-numbers {1}
2933<template>
3034 <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>
3642</template>
3743
3844<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+ };`;
4851</script>
4952```
5053
@@ -82,13 +85,15 @@ greet('World');
8285
8386## Props:
8487
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. |
9297
9398<!-- ## Custom Styling
9499
0 commit comments