пятница, 8 мая 2009 г.

Как запостить свой код на blogger.com.

Итак привожу статью как она есть на http://urenjoy.blogspot.com/2008/10/publish-source-code-in-blogger.html

Publish Source code in Blogger
After posting any source code, First we make sure that the code is correct and same as the original. For HTML or script source code, we require HTML Encoding so that blogger doesn't execute this code.The Source code format should be different from content and there should be option for copy code or print code so that user don't need to select entire code and press ctrl+c. I use "Syntaxhighligher" to display source code in blogger. It fullfills all requirement. First Layout is very pretty with line numbers and it provides "View Plain" (To display only source code in another window),"Copy to clipboard" and "Print?" options. We will see How can we use syntaxhighlighter in blogger without any hosting.

1.In the blogger,Click on Layout tab ->Edit HTML and put following things Before

<link href="http://syntaxhighlighter.googlecode.com/svn/trunk/Styles/SyntaxHighlighter.css" type="text/css" rel="stylesheet">
<script language="javascript" src="http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shCore.js">
<script language="'javascript'" src="'http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCpp.js'/">

2. put following things Before </body>

<script language="javascript">

3. encode (HTML Encode) your source code. for this, you can use this

Copy your code in notepad and replace all < class="Cpp" name="code">
….My code here…

PS http://hype-free.blogspot.com/2006/10/how-to-publish-good-looking-code-on.html

Комментариев нет: