vue-code-highlight
vue-code-highlight copied to clipboard
Example code (in codesandbox) is wrong, and doesn't work even after fixing it
I need to use the directive mode, however, it doesn't work.
I noticed the codesandbox (here) has an example using the directive mode. You should just need to comment out <component-example/> and uncomment the directive one.
However the code for DirectiveExample.vue is wrong, it should be:
<template>
<div>
<h2>vue-code-highlight example</h2>
<div v-highlight>
<pre class="language-javascript">
<code>
let isPalindrome = (word) => {
let [length, result] = [word.length, true];
for (let i = 0; i < length / 2; i++) {
if (word[i] !== word[length - 1 - i]) result = false;
}
return result;
}
module.exports = isPalindrome;
</code>
</pre>
</div>
</div>
</template>
But it gives wrong result (i.e., no syntax highlight)

The repository got quite outdated during the years. I will need to update it to newer setup, esp. vue–cli-service version and get rid of some obsolete code. This should fix the issue.