Coder Social home page Coder Social logo

ci-markdown's Introduction

CI Markdown

CI Markdown is a CodeIgniter library for parsing Markdown. It's a modified rendition of Michel Fortin's PHP Markdown.

See the ChangeLog for a complete list of PHP Markdown modifications.

Requirements

  • PHP 5.2x+
  • CodeIgniter v2.1.0 to v3.x-dev

Installation

Save Markdown.php to your CodeIgniter application/libraries folder.

Usage

Loading the Library

Load the CI Markdown library from your Controller.

$this->load->library('markdown');

Or auto-load it from your application/config/autoload.php config file.

$autoload['libraries'] = array('markdown');

Parsing Markdown

$this->markdown->parse()

The parse() method accepts a single parameter for a Markdown formatted string. It returns an HTML formatted string.

Example
$markdown_formatted_text = '# Heading ' . "\n\n" . '## Sub-heading' . "\n\n";
echo $this->markdown->parse($markdown_formatted_text);
// outputs <h1>Heading</h1><h2>Sub-heading</h2>

$this->markdown->parse_file();

The parse_file() method accepts a single parameter for a Markdown formatted file. It returns an HTML formatted string.

Example
$markdown_file_path = 'test.md';
echo $this->markdown->parse_file($markdown_file_path);
// outputs <h1>Hello world!</h1><h2>I was once in a file!</h2>

NOTE: If the Markdown file does not exist, false is returned.

Changes

  • See the ChangeLog for a detailed list of changes.

TODO

  • Unit tests

Resources

Feedback

Jon LaBelle [email protected]

Issues

https://github.com/jonlabelle/ci-markdown/issues

ci-markdown's People

Contributors

jonlabelle avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.