SamyPesse/draft-js-prism

Different language highlighting examples

yasuf opened this issue · 3 comments

yasuf commented

Can you point me on the right direction as to how to select a different language other than JS when highlighting using this decorator?

I can try putting something together so that this repo could have an example on the README on how to do that.

I have the same question! Thanks again:)

Yeah same, I would like for it to auto detect which language!

Here is how you are able to do that:

      {
        type: "code-block",
        text: 'var message = "This is awesome!";',
        data: {
          syntax: "javascript",
        },
      },
      {
        type: "code-block",
        text: "<h1>I am superman</h1>",
        data: {
          syntax: "html",
        },
      },

so, you just need to figure out how blocks are working and add a block with syntax you need