Artist : Blogging tips: Including source code in your website
Episode : Blogging tips: Including source code in your website
Blogging tips: Including source code in your website
Artikel Blogger, Artikel Blogging, Artikel css, Artikel syntaxhighlighter,Blogging tips: Including source code in your website
If you're a blogger that want to write source code, maybe you have some problems to include it into your blog due to the tags, escape chars, the highlighting and more problems.Two common and great solutions are SyntaxHighlighter and Code Prettifier. Both give your source code the syntax highlighting (depending on the selected language), line numbers, a well done layout and a lot of colors.
The only "problem" that I can find with those utils is that both are javascript and css files that you must download and load in the body of your webpage and host in your server (although SyntaxHighligther offers a hosting service). The problem of adding external CSS files to your website is that if you don't have access to the server, such as in Blogger, you maybe will need to do some dirty workarounds like pasting the full CSS into the template (see how to include SyntaxHighlighter to Blogger).
- // Source code SyntaxHighlighter like
- private static long convertMilliSecondsToDaysViaMoreExplanatoryMagicNumbers(final long numberMilliseconds)
- {
- // 60 seconds in minute, 60 minutes in hour, 24 hours in day, and
- // one thousand milliseconds in a second
- return numberMilliseconds / (60 * 60 * 24 * 1000);
- }
This is wonderful if you write a lot of lines of code, but what if you need to write only a few number of code lines? What if you don't want an overloaded layout? Does it worth the effort to download the files, host them (there are several files) and copy the entire CSS into your blogger's layout?
HTML gives you the <pre/> and <code/> tags, but them really only escape and change the font. The solution that I've found in devcha is to change the <pre/> style to have a backgrounded piece of code. It doesn't have colored keywords, but it's more readable.
<pre style="background-color:#eeeeee; border-color:rgb(153, 153, 153); border-style:dashed; border-width:1px; margin:0px; overflow:auto; padding:5px; width:95%;">
YOUR CODE GOES HERE
</pre>
Of course, set the <pre/> attributes as you like. Remember, that if you're inserting this in Blogger, you should write it in the HTML edition mode.
Thus articles Blogging tips: Including source code in your website
A new berita Blogging tips: Including source code in your website, hopefully we can add to the excitement of your life.
You're reading an article Blogging tips: Including source code in your website and this article is a url permalink I hope this article can be useful .
Tag : Blogger, Blogging, css, syntaxhighlighter,
0 Response to "Blogging tips: Including source code in your website"
Post a Comment