laobubu / HyperMD

A WYSIWYG Markdown Editor for browsers. Break the Wall between writing and previewing.
MIT License
1.47k stars 137 forks source link

Not Highlighting code blocks in vue #76

Open CSFM93 opened 3 years ago

CSFM93 commented 3 years ago

Hi thanks for creating such an amazing library, i have tried to use it but it doesn't highlight code blocks.

The code i tried:

var HyperMD = require("hypermd");

export default {
  name: "MdEditor",
  data: () => ({
    rendered: false,
  }),

  methods: {
    render() {
      if (!this.rendered) {
        var myTextarea = document.getElementById("input-area");
        var editor = HyperMD.fromTextArea(myTextarea, {
          lineNumbers: false,
          mode: {
            name: "hypermd",
            hashtag: true, 
          },
        });
        editor.setSize(null, "900px"); // set height
      }
    },
  },
};
mikeerickson commented 3 years ago

@CSFM93 Were you ever able to get this working? I have been fighting with this library and cant seem to get it working with Vue. In my case, I always receive an error

Cannot read property 'value' of null