Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonlabelle/ci-markdown
CI Markdown is a CodeIgniter library for parsing Markdown to HTML.
https://github.com/jonlabelle/ci-markdown
ci-markdown codeigniter library markdown markdown-parser php php-markdown
Last synced: 19 days ago
JSON representation
CI Markdown is a CodeIgniter library for parsing Markdown to HTML.
- Host: GitHub
- URL: https://github.com/jonlabelle/ci-markdown
- Owner: jonlabelle
- Created: 2012-10-14T20:59:05.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2024-05-23T14:18:47.000Z (7 months ago)
- Last Synced: 2024-11-14T00:03:08.950Z (28 days ago)
- Topics: ci-markdown, codeigniter, library, markdown, markdown-parser, php, php-markdown
- Language: PHP
- Homepage:
- Size: 163 KB
- Stars: 98
- Watchers: 8
- Forks: 38
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- project-awesome - jonlabelle/ci-markdown - CI Markdown is a CodeIgniter library for parsing Markdown to HTML. (PHP)
README
# CI Markdown
CI Markdown is a modified rendition of Michel Fortin's [PHP Markdown][1]
and [PHP Markdown Extra][2] for [CodeIgniter][3].## Install
### Requirements
- [PHP][4] version 5.4.8 or newer
- [CodeIgniter][3] version 2.x – v3.x### Download
Download and extract the [zip][5] release to your CoddeIgniter
`application/libraries/` directory.**The extracted path should resemble:**
- `application/libraries/Markdown.php`
## Usage
### Configuration
Custom [PHP Markdown settings](https://michelf.ca/projects/php-markdown/configuration/)
are defined in the [config/markdown.php](config/markdown.php) config file.### Initializing the Markdown Class
Like most other classes in CodeIgniter, initialize it from your controller
using the `$this->load->library()` method:```php
$this->load->library('markdown');
```To programmatically configure the Markdown instance, overriding any matched
settings defined in the [config file](config/markdown.php):```php
$config = array(
'tab_width' => 2,
'no_markup' => true,
'empty_element_suffix' => '/>'
);$this->load->library('markdown', $config);
```#### Markdown to HTML
- `$this->markdown->transform()`
Accepts a single `string` parameter of Markdown *text* and returns the
transformed HTML.```php
$this->load->library('markdown');$markdownText = "# Heading "."\n"."## Sub-heading";
echo $this->markdown->transform($markdownText);
//Heading
//Sub-heading
```#### Markdown file to HTML
- `$this->markdown->transform_file()`
Accepts a single `string` parameter for a Markdown *file path* and returns the
transformed HTML.```php
$this->load->library('markdown');echo $this->markdown->transform_file('/path/to/markdown/file.md');
//Heading
//Sub-heading
```## Issues
For all issues including feature requests, please [open a new issue][6].
## Changes
See the [Changelog][7] page.
## Credits
- [John Gruber](http://daringfireball.net/)
- [Michel Fortin](https://michelf.ca/home/)[1]: https://michelf.ca/projects/php-markdown/
[2]: https://michelf.ca/projects/php-markdown/extra/
[3]: https://www.codeigniter.com
[4]: https://php.net
[5]: https://github.com/jonlabelle/ci-markdown/archive/master.zip
[6]: https://github.com/jonlabelle/ci-markdown/issues/new
[7]: https://github.com/jonlabelle/ci-markdown/blob/master/CHANGELOG.md