How To Display Source Code With Indent In A Web Page? HTML? CSS?
I want to show some source code with the WebBrowser control on a winform. And I want to decorate the source code with HTML tags, such as color, font, and size. But I found it diffi
Solution 1:
I like to paste my code in a Gist and then display it that way. Github will recognize the code and format it accordingly.
If you're going to be doing it often you could try markdown.
Or use a one-off formatter like Syntax Highlighter.
Solution 2:
The <pre>
element (using <code>
elements with appropriate class names to mark up the parts you want to syntax highlight)
<pre><code class="javascript"><code class="keyword">function</code> <code class="name">foo</code>()…
Solution 3:
You might want to look into this JavaScript library to highlight and format your code. http://code.google.com/p/syntaxhighlighter/
Or you can check out a service like this - http://pygments.appspot.com/ or this - http://hilite.me/
Post a Comment for "How To Display Source Code With Indent In A Web Page? HTML? CSS?"