martedì 4 gennaio 2011

Aggiungere la Syntax highlighter al proprio blog / Add Syntax highlighter to your blog

 

Primo scoglio nella realizzazione di questo blog è stato l’inserimento del codice all’interno di esso, alla fine sono riuscito a trovare la soluzione con SyntaxHighlighter.

Per utilizzarlo nel nostro blog andiamo nelle impostazioni del nostro sito in

Design->Modifica HTML

In Modifica Modello trovare il tag </head> ed inserire PRIMA di esso il seguente codice:

First problem in the creation of this blog has been placing the code inside of it, I finally managed to find the solution with SyntaxHighlighter.

To use it in our blog go in the settings of our site

Design-> Edit HTML

In the Edit Model to find the </ head> and insert before it the following code:

<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeRDark.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPowerShell.js' type='text/javascript'/>
<script language='javascript'>
SyntaxHighlighter.config.bloggerMode=true;
SyntaxHighlighter.config.clipboardSwf=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
</script>

Fatto questo vi basterà inserire il testo che volete visualizza tra tag <pre></pre>


Now you can just enter the text you want displayed in <pre> </ pre> tags

<pre class="brush: js">    
/** * SyntaxHighlighter */
function foo()
{
if (counter <= 10)
return; // it works!
}
</pre>

Se come me utilizzate Windows Live Writer potete utilizzare il plugin Precode Code Snippet Manager per velocizzarne l’inserimento


If like me you are using Windows Live Writer you can use the pkugin Precode Code Snippet Manager to expedite the inclusion

Nessun commento:

Posta un commento