Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexzhang1030/vue-shiki-input

A Shiki input component for Vue.
https://github.com/alexzhang1030/vue-shiki-input

shiki syntax-highlighting vue

Last synced: 7 days ago
JSON representation

A Shiki input component for Vue.

Awesome Lists containing this project

README

        

# vue-shiki-input

NPM Version
NPM Downloads
License

A Shiki input component for Vue.

Inspired by the awesome🀩 shiki playground from [shiki-docs home](https://shiki.style/).

Check out the [docs](https://vue-shiki-input.vercel.app/)!

> πŸ”¨ Working on docs...

## Installation

```bash
pnpm i vue-shiki-input
```

## Usage

```vue

import { ref } from 'vue'
import { VueShikiInput } from 'vue-shiki-input'
import 'vue-shiki-input/style.css'

const text = ref('const a = 1;')

```

### Props

```ts
export interface VueShikiInputProps {
/**
* The code to be edited
*/
modelValue: string
/**
* Disabled editor, will only render code
*/
disabled?: boolean
/**
* Loading state, you should use v-model:loading to bind this prop
*/
loading?: boolean
/**
* Automatically set background color based on the theme
* @default false
*/
autoBackground?: boolean
/**
* Preload languages, you can ignore this if you don't need to preload languages
*/
langs?: (LanguageInput | string)[]
/**
* Preload themes, you can ignore this if you don't need to preload languages
*/
themes?: (ThemeInput | string)[]
/**
* Same as codeToHTML props in shiki
*/
codeToHtmlOptions?: CodeToHastOptions
/**
* Show line numbers
*/
lineNumbers?: boolean
/**
* Line numbers color
*/
lineNumbersColor?: string
/**
* Custom styles
*/
styles?: {
textareaClass?: string
codeClass?: string
}
/**
* Skip loading built-in themes and languages
* This will be useful when you sure you don't need built-in themes and languages
*/
skipLoadShikiBundled?: boolean
/**
* Editor offset
* - x -> padding left+right
* - y -> padding top+bottom
*/
offset?: {
x: number
y: number
}
/**
* Required when use customTheme, and cannot detect dark theme automatically (by type in theme)
*/
darkTheme?: boolean
}
```

## License

MIT