CI Markdown is a modified rendition of Michel Fortin's PHP Markdown and PHP Markdown Extra for CodeIgniter.
- PHP version 5.2.4 or newer
- CodeIgniter version 2.x – v3.x
Download and extract the zip release to your CoddeIgniter
application/libraries/
directory.
The extracted path should resemble:
application/libraries/Markdown.php
Customized PHP Markdown settings can be specified in the config/markdown.php config file.
Like most other classes in CodeIgniter, the Markdown class is initialized in
your controller using the $this->load->library()
method:
$this->load->library('markdown');
Once loaded, the Markdown library object will be available using:
$this->markdown
$this->markdown->parse()
Accepts a single string
parameter of Markdown text and returns the parsed
HTML.
$this->load->library('markdown');
$markdownText = "# Heading "."\n\n"."## Sub-heading"."\n\n";
echo $this->markdown->parse($markdownText);
>>> <h1>Heading</h1><h2>Sub-heading</h2>
$this->markdown->parse_file()
Accepts a single string
parameter for a Markdown file path and returns the
parsed HTML.
$this->load->library('markdown');
echo $this->markdown->parse_file('/path/to/markdown/file.md');
>>> <h1>CI Markdown</h1><p>CI Markdown is a modified rendition...</p>
For all issues including feature requests, please open a new issue.
See the Changelog page.
- Jon LaBelle contact@jonlabelle.com