Markdown Syntax
Headers
Paragraphs
Links
Code blocks
Unordered Lists
Ordered Lists
Nested Lists
Italics and Bold
Horizontal Rules
Images
Tables
Userguide Specific Syntax
Namespacing
API Links
Notes
Headers automatically get IDs
Including Views
The userguide uses Markdown and Markdown Extra for the userguide pages, and the in-code comments used to generate the API browser. This is a brief summary of most of Markdown and Markdown extra features. It does not cover everything, and it does not cover all the caveats.
Be sure to check out the Userguide Specific Syntax for things that Userguide adds to markdown.
Headers
# Header 1
## Header 2
### Header 3
#### Header 4
Paragraphs
Regular text will be transformed into paragraphs.
Single returns will not make a new paragraph, this
allows for wrapping (especially for in-code
comments).
A new paragraph will start if there is a blank line between
blocks of text. Chars like > and & are escaped for you.
To make a line break,
put two spaces at the
end of a line.
Regular text will be transformed into paragraphs. Single returns will not make a new paragraph, this allows for wrapping (especially for in-code comments).
A new paragraph will start if there is a blank line between blocks of text. Chars like > and & are escaped for you.
To make a line break,
put two spaces at the
end of a line.
Links
This is a normal link: [Kohana](http://kohanaframework.org).
This link has a title: [Kohana](http://kohanaframework.org "The swift PHP framework")
This is a normal link: Kohana
This link has a title: Kohana
Code blocks
For inline code simply surround some `text with tick marks.`
For inline code simply surround some text with tick marks.
// For a block of code,
// indent in four spaces,
// or with a tab
You can also do a "fenced" code block:
~~~
A fenced code block has tildes
above and below it
This is sometimes useful when code is near lists
~~~
A fenced code block has tildes
above and below it
This is sometimes useful when code is near lists
Unordered Lists
* To make a unordered list, put an asterisk, minus, or + at the beginning
- of each line, surrounded by spaces. You can mix * - and +, but it
+ makes no difference.
- To make a unordered list, put an asterisk, minus, or + at the beginning
- of each line, surrounded by spaces. You can mix * - and +, but it
- makes no difference.
Ordered Lists
1. For ordered lists, put a number and a period
2. On each line that you want numbered.
9. It doesn't actually have to be the correct number order
5. Just as long as each line has a number
- For ordered lists, put a number and a period
- On each line that you want numbered.
- It doesn't actually have to be the correct number order
- Just as long as each line has a number
Nested Lists
* To nest lists you just add four spaces before the * or number
1. Like this
* It's pretty basic, this line has eight spaces, so its nested twice
1. And this line is back to the second level
* Out to third level again
* And back to the first level
- To nest lists you just add four spaces before the * or number
- Like this
- It's pretty basic, this line has eight spaces, so its nested twice
- And this line is back to the second level
- Out to third level again
- Like this
- And back to the first level
Italics and Bold
Surround text you want *italics* with *asterisks* or _underscores_.
**Double asterisks** or __double underscores__ makes text bold.
***Triple*** will do *both at the same **time***.
Surround text you want italics with asterisks or underscores.
Double asterisks or double underscores makes text bold.
Triple will do both at the same time.
Horizontal Rules
Horizontal rules are made by placing 3 or more hyphens, asterisks, or underscores on a line by themselves.
---
* * * *
_____________________
Images
Image syntax looks like this:


Note that the images in userguide are namespaced.
Tables
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
| First Header | Second Header |
|---|---|
| Content Cell | Content Cell |
| Content Cell | Content Cell |
Note that the pipes on the very left and very right side are optional, and you can change the text-alignment by adding a colon on the right, or on both sides for center.
| Item | Value | Savings |
| --------- | -----:|:-------:|
| Computer | $1600 | 40% |
| Phone | $12 | 30% |
| Pipe | $1 | 0% |
| Item | Value | Savings |
|---|---|---|
| Computer | $1600 | 40% |
| Phone | $12 | 30% |
| Pipe | $1 | 0% |
Userguide Specific Syntax
In addition to the features and syntax of Markdown and Markdown Extra the following apply to userguide pages and api documentation:
Namespacing
The first thing to note is that all links are "namespaced" to the current module. For example, from anywhere within the Kohana core docs you do not need to include kohana at the beginning of a link url. For example: [Hello World Tutorial](tutorials/hello-world) rather than (kohana/tutorials/hello-world).
To link to a modules index page, have an empty url like: [Kohana]().
To link to page in a different module, prefix your url with ../ and the module name. For example: [Kohana Routes](../kohana/routing)
Images are also namespaced, using  would look for media/guide/<modulename>/imagename.jpg.
API Links
You can make links to the api browser by wrapping any class name in brackets. You may also include a function name, or propery name to link to that specifically. All of the following will link to the API browser:
[Request]
[Request::execute]
[Request::execute()]
[Request::$status]
Request
Request::execute
Request::execute()
Request::$status
If you want to have parameters and have the function be clickable, only put the brackets around the class and function (not the params), and put a backslash in front of the opening parenthesis.
[Kohana::config]\('foobar','baz')
Kohana::config('foobar','baz')
Notes
If you put [!!] in front of a line it will be a "note" and be placed in a box with a lightbulb.
[!!] This is a note
will display as:
This is a note
Headers automatically get IDs
Headers are automatically assigned an id, based on the content of the header, so each header can be linked to. You can manually assign a different id using the syntax as defined in Markdown Extra. If multiple headers have the same content (e.g. more than one "Examples" header), only the first will get be automatically assigned an id, so you should manually assign more descriptive ids. For example:
### Examples {#more-descriptive-id}
Including Views
If you need you may include a regular Kohana View file by placing the name of the view in double curly brackets. If the view is not found, no error or exception will be shown, the curly brackets and view name will simply remain there!
Kohana_View_Exception [ 0 ]:
SYSPATH/classes/kohana/view.php [ 252 ]
247 */
248 public function set_filename($file)
249 {
250 if (($path = Kohana::find_file('views', $file)) === FALSE)
251 {
252 throw new Kohana_View_Exception('The requested view :file could not be found', array(
253 ':file' => $file,
254 ));
255 }
256
257 // Store the file path locally
-
SYSPATH/classes/kohana/view.php [ 137 ]
»
Kohana_View->set_filename(arguments)
0
string(14) "some/view/file"
132 */
133 public function __construct($file = NULL, array $data = NULL)
134 {
135 if ($file !== NULL)
136 {
137 $this->set_filename($file);
138 }
139
140 if ($data !== NULL)
141 {
142 // Add the values to the current data
-
SYSPATH/classes/kohana/view.php [ 30 ]
»
Kohana_View->__construct(arguments)
0
string(14) "some/view/file"
1
NULL
25 * @param array array of values
26 * @return View
27 */
28 public static function factory($file = NULL, array $data = NULL)
29 {
30 return new View($file, $data);
31 }
32
33 /**
34 * Captures the output that is generated when a view is included.
35 * The view data will be extracted to make local variables. This method
-
MODPATH/userguide/classes/kohana/kodoc/markdown.php [ 157 ]
»
Kohana_View::factory(arguments)
0
string(14) "some/view/file"
152 {
153 list($search, $view) = $set;
154
155 try
156 {
157 $replace[$search] = View::factory($view)->render();
158 }
159 catch (Exception $e)
160 {
161 ob_start();
162
-
MODPATH/userguide/vendor/markdown/markdown.php [ 330 ]
»
Kohana_Kodoc_Markdown->doIncludeViews(arguments)
0
string(9679) "<h1 id="markdown-syntax">Markdown Syntax</h1>
<p>The userguide uses <a href="http://daringfireball.net/projects/markdown/">Mark …"
325 # contorted like /[ ]*\n+/ .
326 $text = preg_replace('/^[ ]+$/m', '', $text);
327
328 # Run document gamut methods.
329 foreach ($this->document_gamut as $method => $priority) {
330 $text = $this->$method($text);
331 }
332
333 $this->teardown();
334
335 return $text . "\n";
-
MODPATH/userguide/vendor/markdown/markdown.php [ 64 ]
»
Markdown_Parser->transform(arguments)
0
string(7500) "# Markdown Syntax
The userguide uses [Markdown](http://daringfireball.net/projects/markdown/) and [Markdown Extra](http://miche …"
59 $parser_class = MARKDOWN_PARSER_CLASS;
60 $parser = new $parser_class;
61 }
62
63 # Transform text using parser.
64 return $parser->transform($text);
65 }
66
67
68 ### WordPress Plugin Interface ###
69
-
MODPATH/userguide/classes/controller/userguide.php [ 159 ]
»
Markdown(arguments)
text
string(7500) "# Markdown Syntax
The userguide uses [Markdown](http://daringfireball.net/projects/markdown/) and [Markdown Extra](http://miche …"
154 // Set the page title
155 $this->template->title = $page == 'index' ? Kohana::config('userguide.modules.'.$module.'.name') : $this->title($page);
156
157 // Parse the page contents into the template
158 Kodoc_Markdown::$show_toc = true;
159 $this->template->content = Markdown(file_get_contents($file));
160 Kodoc_Markdown::$show_toc = false;
161
162 // Attach this module's menu to the template
163 $this->template->menu = Markdown($this->_get_all_menu_markdown());
164
-
{PHP internal call}
»
Controller_Userguide->action_docs(arguments)
0
string(9) "userguide"
1
string(8) "markdown"
-
SYSPATH/classes/kohana/request.php [ 1217 ]
»
ReflectionMethod->invokeArgs(arguments)
0
object Controller_Userguide(6) {
public template => object View(2) {
protected _file => string(66) "/var/www/guides/3.0/modules/userguide/views/userguide/template.php"
protected _data => array(1) (
"title" => string(15) "Markdown Syntax"
)
}
protected media => object Route(4) {
protected _uri => string(20) "guide/media(/<file>)"
protected _regex => array(1) (
"file" => string(2) ".+"
)
protected _defaults => array(3) (
"controller" => string(9) "userguide"
"action" => string(5) "media"
"file" => NULL
)
protected _route_regex => string(35) "#^guide/media(?:/(?P<file>.+))?$#uD"
}
protected api => NULL
protected guide => object Route(4) {
protected _uri => string(25) "guide(/<module>(/<page>))"
protected _regex => array(1) (
"page" => string(2) ".+"
)
protected _defaults => array(3) (
"controller" => string(9) "userguide"
"action" => string(4) "docs"
"module" => string(0) ""
)
protected _route_regex => string(59) "#^guide(?:/(?P<module>[^/.,;?\n]++)(?:/(?P<page>.+))?)?$#uD"
}
public auto_render => bool TRUE
public request => object Request(9) {
public route => object Route(4) {
protected _uri => string(25) "guide(/<module>(/<page>))"
protected _regex => array(1) (
"page" => string(2) ".+"
)
protected _defaults => array(3) (
"controller" => string(9) "userguide"
"action" => string(4) "docs"
"module" => string(0) ""
)
protected _route_regex => string(59) "#^guide(?:/(?P<module>[^/.,;?\n]++)(?:/(?P<page>.+))?)?$#uD"
}
public status => integer 200
public response => string(0) ""
public headers => array(1) (
"Content-Type" => string(24) "text/html; charset=utf-8"
)
public directory => string(0) ""
public controller => string(9) "userguide"
public action => string(4) "docs"
public uri => string(24) "guide/userguide/markdown"
protected _params => array(2) (
"module" => string(9) "userguide"
"page" => string(8) "markdown"
)
}
}
1
array(2) (
"module" => string(9) "userguide"
"page" => string(8) "markdown"
)
1212
1213 // Determine the action to use
1214 $action = empty($this->action) ? Route::$default_action : $this->action;
1215
1216 // Execute the main action with the parameters
1217 $class->getMethod('action_'.$action)->invokeArgs($controller, $this->_params);
1218
1219 // Execute the "after action" method
1220 $class->getMethod('after')->invoke($controller);
1221 }
1222 catch (Exception $e)
-
/var/www/guides/3.0-bootstrap.php [ 108 ]
»
Kohana_Request->execute()
103 /**
104 * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
105 * If no source is specified, the URI will be automatically detected.
106 */
107 echo Request::instance()
108 ->execute()
109 ->send_headers()
110 ->response;
111 }
-
DOCROOT/3.0-index.php [ 109 ]
»
require(arguments)
0
string(33) "/var/www/guides/3.0-bootstrap.php"
104 // Load empty core extension
105 require SYSPATH.'classes/kohana'.EXT;
106 }
107
108 // Bootstrap the application
109 require '../guides/3.0-bootstrap'.EXT;
Environment
Included files (59)
DOCROOT/3.0-index.php
SYSPATH/base.php
SYSPATH/classes/kohana/core.php
SYSPATH/classes/kohana.php
/var/www/guides/3.0-bootstrap.php
SYSPATH/classes/kohana/log.php
SYSPATH/classes/kohana/config.php
SYSPATH/classes/kohana/log/file.php
SYSPATH/classes/kohana/log/writer.php
SYSPATH/classes/kohana/config/file.php
SYSPATH/classes/kohana/config/reader.php
MODPATH/codebench/init.php
SYSPATH/classes/route.php
SYSPATH/classes/kohana/route.php
MODPATH/userguide/init.php
SYSPATH/classes/arr.php
SYSPATH/classes/kohana/arr.php
SYSPATH/config/userguide.php
MODPATH/userguide/config/userguide.php
MODPATH/pagination/config/userguide.php
MODPATH/oauth/config/userguide.php
MODPATH/orm/config/userguide.php
MODPATH/image/config/userguide.php
MODPATH/database/config/userguide.php
MODPATH/codebench/config/userguide.php
MODPATH/cache/config/userguide.php
MODPATH/auth/config/userguide.php
SYSPATH/classes/request.php
SYSPATH/classes/kohana/request.php
SYSPATH/classes/profiler.php
SYSPATH/classes/kohana/profiler.php
MODPATH/userguide/classes/controller/userguide.php
SYSPATH/classes/controller/template.php
SYSPATH/classes/kohana/controller/template.php
SYSPATH/classes/controller.php
SYSPATH/classes/kohana/controller.php
MODPATH/userguide/vendor/markdown/markdown.php
MODPATH/userguide/classes/kodoc/markdown.php
MODPATH/userguide/classes/kohana/kodoc/markdown.php
SYSPATH/classes/url.php
SYSPATH/classes/kohana/url.php
SYSPATH/classes/utf8.php
SYSPATH/classes/kohana/utf8.php
SYSPATH/classes/view.php
SYSPATH/classes/kohana/view.php
SYSPATH/utf8/transliterate_to_ascii.php
MODPATH/userguide/classes/kodoc.php
MODPATH/userguide/classes/kohana/kodoc.php
SYSPATH/classes/html.php
SYSPATH/classes/kohana/html.php
SYSPATH/classes/kohana/view/exception.php
SYSPATH/classes/kohana/exception.php
SYSPATH/classes/i18n.php
SYSPATH/classes/kohana/i18n.php
SYSPATH/classes/date.php
SYSPATH/classes/kohana/date.php
SYSPATH/views/kohana/error.php
SYSPATH/utf8/strlen.php
SYSPATH/utf8/substr.php
Loaded extensions (31)
Core
date
ereg
libxml
openssl
pcre
sqlite3
zlib
ctype
dom
fileinfo
filter
hash
iconv
json
SPL
PDO
pdo_sqlite
session
posix
Reflection
standard
SimpleXML
SQLite
Phar
tokenizer
xml
xmlreader
xmlwriter
cgi-fcgi
curl
$_SERVER
USER
string(25) "u4ed3ba8b48afd82df60007bb"
HOME
string(31) "/home/u4ed3ba8b48afd82df60007bb"
FCGI_ROLE
string(9) "RESPONDER"
REDIRECT_REDIRECT_UNIQUE_ID
string(24) "UaG6VawQTiIAAEFtQAIAAAAA"
REDIRECT_REDIRECT_SCRIPT_URL
string(29) "/3.0/guide/userguide/markdown"
REDIRECT_REDIRECT_SCRIPT_URI
string(55) "http://kohanaframework.org/3.0/guide/userguide/markdown"
REDIRECT_REDIRECT_HTTP_AUTHORIZATION
string(0) ""
REDIRECT_REDIRECT_CACHE2_HOST
string(20) "tunnel.pagodabox.com"
REDIRECT_REDIRECT_CACHE2_PORT
string(5) "11211"
REDIRECT_REDIRECT_STATUS
string(3) "200"
REDIRECT_UNIQUE_ID
string(24) "UaG6VawQTiIAAEFtQAIAAAAA"
REDIRECT_SCRIPT_URL
string(29) "/3.0/guide/userguide/markdown"
REDIRECT_SCRIPT_URI
string(55) "http://kohanaframework.org/3.0/guide/userguide/markdown"
REDIRECT_HTTP_AUTHORIZATION
string(0) ""
REDIRECT_CACHE2_HOST
string(20) "tunnel.pagodabox.com"
REDIRECT_CACHE2_PORT
string(5) "11211"
REDIRECT_HANDLER
string(11) "php-fastcgi"
REDIRECT_STATUS
string(3) "200"
UNIQUE_ID
string(24) "UaG6VawQTiIAAEFtQAIAAAAA"
SCRIPT_URL
string(29) "/3.0/guide/userguide/markdown"
SCRIPT_URI
string(55) "http://kohanaframework.org/3.0/guide/userguide/markdown"
HTTP_AUTHORIZATION
string(0) ""
CACHE2_HOST
string(20) "tunnel.pagodabox.com"
CACHE2_PORT
string(5) "11211"
HTTP_HOST
string(19) "kohanaframework.org"
HTTP_CONNECTION
string(10) "Keep-Alive"
HTTP_ACCEPT_ENCODING
string(4) "gzip"
HTTP_CF_CONNECTING_IP
string(14) "54.234.180.187"
HTTP_CF_IPCOUNTRY
string(2) "US"
HTTP_CF_RAY
string(15) "748c4373730069d"
HTTP_CF_CIP_TAG
string(1) "0"
HTTP_CF_VISITOR
string(17) "{"scheme":"http"}"
HTTP_CF_WAN_ID
string(1) "0"
HTTP_CF_WAN_ENCODING
string(1) "0"
HTTP_USER_AGENT
string(9) "CCBot/2.0"
HTTP_ACCEPT_LANGUAGE
string(28) "en-us,en-gb,en;q=0.7,*;q=0.3"
HTTP_ACCEPT
string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
HTTP_X_FORWARDED_PORT
string(2) "80"
HTTP_X_FORWARDED_PROTO
string(4) "http"
HTTP_X_FORWARDED_FOR
string(14) "108.162.219.32"
PATH
string(115) "/var/www:/usr/local/nvm/v0.4.12/bin:/usr/bin/php-5.3.8:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin"
SERVER_SIGNATURE
string(0) ""
SERVER_SOFTWARE
string(20) "Apache/2.2.20 (Unix)"
SERVER_NAME
string(19) "kohanaframework.org"
SERVER_ADDR
string(12) "172.16.78.34"
SERVER_PORT
string(2) "80"
REMOTE_ADDR
string(13) "10.60.251.166"
DOCUMENT_ROOT
string(16) "/var/www/public/"
SERVER_ADMIN
string(21) "[email protected]"
SCRIPT_FILENAME
string(29) "/var/www/public/3.0-index.php"
REMOTE_PORT
string(5) "39515"
REDIRECT_URL
string(39) "/3.0-index.php/guide/userguide/markdown"
GATEWAY_INTERFACE
string(7) "CGI/1.1"
SERVER_PROTOCOL
string(8) "HTTP/1.1"
REQUEST_METHOD
string(3) "GET"
QUERY_STRING
string(0) ""
REQUEST_URI
string(29) "/3.0/guide/userguide/markdown"
SCRIPT_NAME
string(14) "/3.0-index.php"
PATH_INFO
string(25) "/guide/userguide/markdown"
PATH_TRANSLATED
string(40) "/var/www/public/guide/userguide/markdown"
ORIG_PATH_INFO
string(39) "/3.0-index.php/guide/userguide/markdown"
ORIG_SCRIPT_NAME
string(16) "/cgi-bin/php-cgi"
ORIG_SCRIPT_FILENAME
string(20) "/usr/cgi-bin/php-cgi"
ORIG_PATH_TRANSLATED
string(54) "/var/www/public/3.0-index.php/guide/userguide/markdown"
PHP_SELF
string(39) "/3.0-index.php/guide/userguide/markdown"
REQUEST_TIME
integer 1369553493