You may want to add code examples, or snippets, to your knowledgebase article to show your users how to achieve a particular effect or address a common problem. KBPublisher makes this easy by providing formatting tags to put around the example. When your readers look at the article, the example code appears, correctly formatted for the coding language you specify, and highlighted as it would appear in a code editor for that language, in a box to set it off from the rest of the text.
There are two options to add code snippet to an article.
To add code snippets to an article by using the toolbar button:
Example:
<?php
$value = 'something from somewhere';
setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "example.com", 1);
?>
Available Languages
In the Language drop down menu, the following options are available:
To add code snippets to an article by using the [code] tag:
Example:
<?php
$value = 'something from somewhere';
setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "example.com", 1);
?>
Available Languages
Find your snippet's coding language on the left side of any pair. Choose one of the entries that appear on the right side. For AS3, for example, you could use "code=as3" or "code=actionscript3".
Code Language | Indicator |
---|---|
AS3 |
|
Bash |
|
CSharp |
|
ColdFusion |
|
Cpp |
|
Css |
|
Delphi |
|
Diff |
|
Erlang |
|
Groovy |
|
JScript |
|
Java |
|
JavaFX |
|
Perl |
|
Php |
|
Plain |
|
PowerShell |
|
Python |
|
Ruby |
|
Scala |
|
Sql |
|
Vb |
|
Xml |
|