Is there a plugin to display HTML code inside my web page

允我心安 提交于 2019-12-13 14:30:16

问题


I want to display large chunk of LESS file in my page. I want it to look as nice as possible so that users who see it will read it easily.

stackoverflow let me display it (for example) like this:

header {
    color: red;
    div.myClass {
         color:blue;
    }
}

but is there a plugin to display it nicer? I mean: div will be displayed in blue and class will be displayed in red, variables will be bold etc...

Is there some sort of javascript or jQuery library that does it?

thanks, Alon


回答1:


StackOverflow uses Prettify to do it's syntax highlighting.

It should work for what you want.




回答2:


SyntaxHighlighter is another really popular one. It's also available as a plugin on many platforms and supports a lot of languages.

http://alexgorbatchev.com/SyntaxHighlighter/




回答3:


Take a look at https://highlightjs.org/. This provides a variety of themes to highlight code written in almost every language.



来源:https://stackoverflow.com/questions/9320112/is-there-a-plugin-to-display-html-code-inside-my-web-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!