Skip to content

Version 4 #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3010027
⬆️ Upgrade dependencies
gluons Dec 29, 2020
2aa0417
🏗 Use pnpm instead of Yarn
gluons Dec 29, 2020
74e1413
👷 Update CI config
gluons Dec 29, 2020
5c44531
🏗 Change linter from TSLint to ESLint
gluons Dec 29, 2020
b89c7ae
♻️ Support Highlight.js v10
gluons Dec 29, 2020
f295be1
💡 Add comment
gluons Dec 29, 2020
eff9a34
♻️ Update code
gluons Dec 29, 2020
c6a3c30
🚨 Change registered component name's case
gluons Dec 29, 2020
d5a3f7a
🏗 Use Yarn 2
gluons Dec 30, 2020
b0ba9bd
⬆️ Upgrade dependencies
gluons Jan 1, 2021
348ce5b
✨ New Vue language definition
gluons Jan 1, 2021
6277b6e
🔧 Update TypeScript configs
gluons Jan 1, 2021
7ef6b9b
🔧 Update ESLint config
gluons Jan 3, 2021
a5faea6
⬆️ Bump ESLint version
gluons Jan 3, 2021
f91f0b5
♻️ Auto register Vue language in web bundle
gluons Jan 3, 2021
d03ba4d
🔧 Update `externals` config for web bundle
gluons Jan 3, 2021
403367b
✅ Remove deprecated test
gluons Jan 3, 2021
0a3af44
👷 Update CI config
gluons Jan 3, 2021
6e983fa
🔧 Update `test` script
gluons Jan 3, 2021
6506ad2
💚 Remove latest Node version
gluons Jan 3, 2021
f341124
⬆️ Upgrade dependencies
gluons Jan 16, 2021
93a0965
🔖 4.0.0-beta
gluons Jan 16, 2021
586f537
📝 Update readme
gluons Jan 16, 2021
dee6d12
🍱 Update Yarn
gluons Jan 16, 2021
9b700a6
👽 Prevent error in Vue 3
gluons Jan 17, 2021
d697209
🐛 Fix incompatible language type
gluons Feb 27, 2021
94100bb
🐛 Fix Vue language not work when individually import
gluons Feb 27, 2021
d9e1291
♻️ Use individually import instead of import all languages
gluons Feb 27, 2021
603e7b0
🔧 Update `globals` config
gluons Feb 28, 2021
296564a
🔖 4.0.1-beta
gluons Feb 28, 2021
f627142
⬆️ Upgrade Yarn
gluons Apr 15, 2021
b670a86
⬆️ Bump dependencies
gluons Apr 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.yarn/
dist/
lib/
22 changes: 22 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"root": true,
"extends": "gluons/vue-ts",
"env": {
"jest": true
},
"globals": {
"IS_WEB_BUNDLE": "readonly"
},
"parserOptions": {
"project": "./tsconfig-eslint.json"
},
"overrides": [
{
"files": "*.ts",
"extends": "gluons/ts",
"parserOptions": {
"project": "./tsconfig-eslint.json"
}
}
]
}
53 changes: 46 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Created by https://www.gitignore.io/api/node,linux,windows
# Edit at https://www.gitignore.io/?templates=node,linux,windows

# Created by https://www.toptal.com/developers/gitignore/api/node,linux,windows
# Edit at https://www.toptal.com/developers/gitignore?templates=node,linux,windows

### Linux ###
*~
Expand All @@ -24,6 +24,10 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
Expand All @@ -36,6 +40,7 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output
Expand All @@ -59,12 +64,21 @@ jspm_packages/
# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

Expand All @@ -76,15 +90,25 @@ typings/

# dotenv environment variables file
.env
.env.test
.env*.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# next.js build output
# Next.js build output
.next

# nuxt.js build output
# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist
Expand All @@ -95,12 +119,19 @@ typings/
# FuseBox cache
.fusebox/

#DynamoDB Local files
# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

Expand All @@ -123,7 +154,15 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/node,linux,windows
# End of https://www.toptal.com/developers/gitignore/api/node,linux,windows

# Yarn 2
.yarn/*
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*

# Dist files
dist/
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev/App.vue
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: node_js
node_js:
- "node"
- "lts/*"
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
notifications:
email: false
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.enable": false
"typescript.tsdk": "node_modules/typescript/lib"
}
77 changes: 77 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions .yarn/releases/yarn-2.4.1.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
nodeLinker: node-modules

npmRegistryServer: "https://registry.npmjs.org"

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-2.4.1.cjs
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,19 @@
[![npm](https://nodei.co/npm/vue-highlight.js.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/vue-highlight.js)

```bash
npm install highlight.js vue-highlight.js
npm install highlight.js vue-highlight.js@next
```

**Or [Yarn](https://yarnpkg.com):**
**Via [Yarn](https://yarnpkg.com):**

```bash
yarn add highlight.js vue-highlight.js
yarn add highlight.js vue-highlight.js@next
```

---

**For [TypeScript](https://www.typescriptlang.org/), Please install [`@types/highlight.js`](https://www.npmjs.com/package/@types/highlight.js).**
**Via [pnpm](https://pnpm.js.org):**

```bash
npm install --save-dev @types/highlight.js
# or
yarn add --dev @types/highlight.js
pnpm add highlight.js vue-highlight.js@next
```

## 🎬 Demo
Expand Down Expand Up @@ -138,15 +134,15 @@ There are 2 ways to import Highlight.js languages.
## ⛕ Plugin Options

### `languages`
**Type:** `{ [name: string]: HLJSLang }`
**Type:** `{ [name: string]: LanguageFn }`
**Default:** `{}`

Highlight.js languages.
Add the languages that you want to use here.

`name` is the name of language to register with **Highlight.js**' [`registerLanguage(name, language)`](https://highlightjs.readthedocs.io/en/latest/api.html#registerlanguage-name-language) API.
`name` is the name of language to register with **Highlight.js**' [`registerLanguage(languageName, languageDefinition)`](https://highlightjs.readthedocs.io/en/latest/api.html#registerlanguage-languagename-languagedefinition) API.

_See https://github.com/isagalaev/highlight.js#commonjs about importing each language from **highlight.js**._
_See https://github.com/isagalaev/highlight.js#nodejs about importing each language from **highlight.js**._

## 📚 API

Expand All @@ -161,7 +157,7 @@ Static code content.
##### lang
**Type:** `String`

Highlight.js [language](http://highlightjs.readthedocs.io/en/latest/css-classes-reference.html#language-names-and-aliases).
Highlight.js [language](https://github.com/isagalaev/highlight.js/blob/master/SUPPORTED_LANGUAGES.md).

##### inline
**Type:** `Boolean`
Expand All @@ -184,7 +180,7 @@ Code content in code block.

Enable auto detecting code language.

> Code will be detected by [highlight.js' `highlightAuto`](https://highlightjs.readthedocs.io/en/latest/api.html#highlightauto-value-languagesubset) function.
> Code will be detected by [highlight.js' `highlightAuto`](https://highlightjs.readthedocs.io/en/latest/api.html#highlightauto-code-languagesubset) function.

**`auto` will work well when you import all Highlight.js languages.**

Expand Down
10 changes: 8 additions & 2 deletions dev/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
import Vue from 'vue';
import VueHighlightJS, { Options } from '../src';

import '../lib/allLanguages';
import javascript from 'highlight.js/lib/languages/javascript';
import vue from '../lib/languages/vue';

import App from './App.vue';

import 'highlight.js/styles/agate.css';

Vue.use<Options>(VueHighlightJS);
Vue.use<Options>(VueHighlightJS, {
languages: {
javascript,
vue
}
});

new Vue({
el: '#app',
Expand Down
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-highlight.js",
"version": "3.1.0",
"version": "4.0.1-beta",
"description": "Highlight.js syntax highlighter component for Vue.",
"main": "./dist/vue-highlight.cjs.js",
"module": "./dist/vue-highlight.es.js",
Expand All @@ -18,9 +18,9 @@
"prelib": "rimraf lib/*",
"lib": "tsc -p tsconfig-lib.json",
"build": "npm run lib && vue-up build",
"lint": "tslint -p .",
"lint": "eslint .",
"format": "prettier --write \"{src/**,src-lib/**,dev/**/*.ts}\"",
"test": "npm run lint && jest"
"test": "npm run lib && npm run lint && jest"
},
"repository": {
"type": "git",
Expand All @@ -41,37 +41,37 @@
},
"homepage": "https://gluons.github.io/vue-highlight.js/",
"peerDependencies": {
"highlight.js": "^9.18.5",
"highlight.js": "10",
"vue": "2"
},
"devDependencies": {
"@gluons/prettier-config": "^2.0.0",
"@gluons/vue-up": "^0.7.1",
"@types/highlight.js": "^9.12.3",
"@types/jest": "^26.0.15",
"@types/node": "8",
"@vue/test-utils": "^1.1.1",
"csstype": "^3.0.5",
"highlight.js": "^9.15.8",
"@gluons/prettier-config": "^2.0.6",
"@gluons/vue-up": "^0.8.1",
"@types/jest": "^26.0.22",
"@types/node": "14",
"@vue/test-utils": "^1.1.4",
"csstype": "^3.0.7",
"eslint": "^7.24.0",
"eslint-config-gluons": "^6.1.0",
"highlight.js": "^10.7.2",
"jest": "^26.6.3",
"npm-run-all": "^4.1.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.2.1",
"rimraf": "^3.0.0",
"ts-jest": "^26.4.4",
"rimraf": "^3.0.2",
"ts-jest": "^26.5.4",
"tsconfig-gluons": "^1.1.0",
"tslint": "^6.1.3",
"tslint-config-gluons": "^2.1.0",
"typescript": "^4.1.2",
"vue": "^2.6.10",
"typescript": "^4.2.4",
"vue": "^2.6.12",
"vue-class-component": "^7.2.6",
"vue-property-decorator": "^9.1.2",
"vue-template-compiler": "^2.6.10"
"vue-template-compiler": "^2.6.12"
},
"dependencies": {
"detect-indent": "^6.0.0",
"redent": "^3.0.0",
"tslib": "^2.0.3"
"tslib": "^2.2.0"
},
"prettier": "@gluons/prettier-config",
"jest": {
"preset": "ts-jest",
"globals": {
Expand Down
1 change: 0 additions & 1 deletion prettier.config.js

This file was deleted.

Loading