Aby móc ładnie zaprezentować kawałek kodu źródłowego w wordpress (i nie tylko) warto skorzystać z http://alexgorbatchev.com/wiki/SyntaxHighlighter
Rozpoznaje on składnie wielu języków, a jego użycie jest banalnie proste. Program występuje jako prosty w instalacji plugin do Wodrpress. Po zainstalowaniu kod programu należy otoczyć dyrektywą sourcecode (usuń cudzysłowowy).
["sourcecode" language="java"]
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
["/sourecode"]
A nasz publikowany kod będzie wyglądał tak:
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
A tutaj przykład dla html
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>
A Small Hello
</TITLE>
</HEAD>
<BODY>
<H1>Hi</H1>
<P>This is very minimal "hello world" HTML document.</P>
</BODY>
</HTML>
COMMENTS
No Comments