hoiheart / vue-diff

VueJS diff viewer plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

extend language 'groovy' and language definition for 'groovy' could not be registered.

zycoJamie opened this issue ยท comments

env:
vue 3.2.11
vue-diff 1.1.3
highlight.js 11.4.0

description:

import VueDiff from 'vue-diff';
import 'vue-diff/dist/index.css';
import groovy from 'highlight.js/lib/languages/groovy';
VueDiff.hljs.registerLanguage('groovy', groovy);

i want to extend language, but i fail, i get an error "Language definition for 'groovy' could not be registered.", because 'hljs.regex' is undefined.

function groovy(hljs) {
  const regex = hljs.regex; // undefined
  const IDENT_RE = '[A-Za-z0-9_$]+';
  .....
}

the highlight.js of vue-diff's dependencies is "^10.5.0", 'hljs.regex' does not exist in here.

but the highlight.js of my project's dependencies is "^11.4.0", 'hljs.regex' is defiined.

version difference of the highlight.js causes problems.

I patched the dependencies and released version 1.1.4.
Please check it out. ๐Ÿ˜€

it is solved. ๐Ÿ˜๐Ÿ‘๐Ÿป