vue-code-highlight icon indicating copy to clipboard operation
vue-code-highlight copied to clipboard

Example code (in codesandbox) is wrong, and doesn't work even after fixing it

Open dbersan opened this issue 5 years ago • 1 comments

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 &lt; 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)

image

dbersan avatar Apr 01 '20 19:04 dbersan

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.

honzabilek4 avatar Jul 01 '20 06:07 honzabilek4