Skip to content

Commit

Permalink
release(3.0.1):update hljs 11 and other dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
SunskyXH committed Jan 11, 2023
1 parent f46a20a commit fa2ca57
Show file tree
Hide file tree
Showing 4 changed files with 392 additions and 264 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@

# vue-hljs

### Install
## Overview
ℹ️ Update: Highlight.js has released an official vue plugin since Mar 23, 2021. See [highlightjs/vue-plugin](https://github.com/highlightjs/vue-plugin).

This is a vue plugin which allows you to highlight code blocks via vue-directive.
## Install

```bash
npm install vue-hljs --save
npm install vue-hljs highlight.js
```
or
```bash
yarn add vue-hljs
yarn add vue-hljs highlight.js
```


### Usage
## Example
```typescript
import { createApp } from 'vue'
import vueHljs from "vue-hljs";
Expand All @@ -29,13 +32,18 @@ app.use(vueHljs, { hljs })
```html
<div v-highlight>
<pre>
<code class="you can specify the language here">...</code>
<!-- you can specify language by modifing the class attribute -->
<code class="typescript">...</code>
</pre>
</div>
```
### Use your own style
## Use your own style

This plugin use gruvbox-dark as default style.

You can wirte your own style or see [highlight.js demo](https://highlightjs.org/static/demo/).
And then import your css file in Vue project entry.

## Other similar project

- [highlightjs/vue-plugin](https://github.com/highlightjs/vue-plugin): Highlight.js official plugin.
2 changes: 1 addition & 1 deletion lib/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { App, Plugin } from 'vue'
import type HLJSApi from 'highlight.js'
import type { HLJSApi } from 'highlight.js'
import './gruvbox-dark.min.css'

interface Options {
Expand Down
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-hljs",
"version": "3.0.0",
"description": "Highlight.js plugin for Vue.js 2.0",
"version": "3.0.1",
"description": "Highlight.js plugin for Vue.js 3.0",
"main": "./dist/vue-hljs.umd.js",
"module": "./dist/vue-hljs.es.js",
"exports": {
Expand All @@ -13,7 +13,6 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"test": "vitest --run",
"coverage": "vitest run --coverage",
"clean": "rm -rf dist/"
Expand Down Expand Up @@ -41,12 +40,12 @@
],
"license": "BSD-3",
"devDependencies": {
"@vitest/coverage-c8": "^0.22.1",
"highlight.js": "^10.5.0",
"typescript": "^4.8.2",
"vite": "^3.0.9",
"vitest": "^0.22.1",
"vue": "^3.2.38"
"@vitest/coverage-c8": "^0.27.0",
"highlight.js": "^11.7.0",
"typescript": "^4.9.4",
"vite": "^4.0.4",
"vitest": "^0.27.0",
"vue": "^3.2.45"
},
"peerDependencies": {
"highlight.js": "^10.0.0",
Expand Down
Loading

0 comments on commit fa2ca57

Please sign in to comment.