How to style text within the code tag?

Asked

Viewed 47 times

0

I would like to leave an excerpt of stylized code as it is in the ide but I do not know how to do this, I looked here and found nothing about it, I would like to leave something similar to what is in the image below with the names of the variables, function, parameters, etc. with a defined color, rather than only text with the default black color of the tag code.

inserir a descrição da imagem aqui.

  • Consider using a lib. There are several: Prism or Highlightjs are examples of this.

1 answer

0

After your comment, I understood what this is about.

If you want to display this information to the end user, I recommend using this JS lib that github, Slack and others use, to Highlight.js, here also has your documentation.

There are some ways to use, as you can see in the tutorial of Getting the library. If you don’t use any framework, you can import directly from CDN that lib is available. I hope I’ve helped, anything, just comment.

  • Opa, good night, the image I inserted was just an example, I would really like to know how to style the variables, functions, etc. but from now, thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.