how to pretty print source code of common languages in browser html output with javascript?

喜你入骨 提交于 2019-12-04 06:29:47

Probably SyntaxHighlighter is the most popular. But you have a choice, have a look at 16 Free Javascript Code Syntax Highlighters For Better Programming

If you mean real time syntax highlighter, you can also try JS-CodeEdit:

JS-CodeEdit is a JavaScript editor that converts your HTML textareas into a code editor with realtime syntax highlighting. If added into a form, the content can be submitted e.g. to be written to a file. A nice thing is that you can add as many editors as you want within a HTML page.

But it support a bit limited list of languages: JavaScript, PHP, Perl, HTML, CSS, XML, SQL (this list is increased with each release).

You might want to check out Giki : http://guyht.github.com/Giki/examples/wiki.html

Its a real time syntax highlighter, very easy to customise.

GitHub Repo: https://github.com/guyht/Giki

Here i got a command line program, what can format and highlight approx. 100 programming languages

http://www.andre-simon.de/dokuwiki/doku.php?id=en:supported_languages

with configurable colour themes and output in HTML, XHTML, RTF, TeX, LaTeX, terminal escape sequences, SVG and BBCode format.

http://www.andre-simon.de/dokuwiki/doku.php?id=en:features

http://www.andre-simon.de/doku/highlight/en/highlight.html

There is a Mac OS quick view plugin available, too. This is not Javascript but you can do the stuff ex. via ajax.

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