Coder Social home page Coder Social logo

markdown's Introduction

CakePHP Markdown

The Markdown plugin provides your CakePHP views with the ability to use Markdown instead of HTML.

Purpose

Why use Markdown instead of HTML you ask? There's a few useful applications. For instance, at Mind the Code I always write my Blog posts in Markdown while in bed or on the road. WHen I'm happy with what I wrote I just create a new entry in my blog database with the markdown text, and the Markdown plugin and some CSS do the rest. No need to go through the whole post and add <br />'s and <h1>'s

Another useful option is using it within a CMS. Instead of having bloated HTML in your database through one of the thousand WYSIWYG editors you can have your content-editors just write Markdown, and have plain and not-so-bloated content in your DB.

Installation

  • Clone the files from the repos into app/Plugin/Markdown
  • Load the plugin by adding the following into app/Config/bootstrap.php:
    • CakePlugin::load('Markdown');
  • Include the Helper in the controllers you want to use it with, or in AppController.php:
    • public $helpers = array('Markdown.Markdown');

Using Markdown

The simplest way to test if everything is working is by passing some markdown to your view. You can use the following example:

In your controller, make a EOF variable containing something like:

Markdown allows you to write text in a easy-to-read and easy-to-write plain text format,
and Markdown will convert it to structurally valid XHTML (or HTML).

You can easily make text **bold** or *italic*  
Use [Some link](http://www.example.com/ "Example")  
Use [Another link][] like so  

And any other Markdown features, as shown on [Daring Fireball][]

  [Another link]: http://www.mindthecode.com/
  [Daring Fireball]: http://daringfireball.net/

And set this to a variable. For instance, $plain and assign it to the view:

$this->set(compact('plain'));

Then in your view, all you have to do is:

<?php echo Markdown($plain); ?>

And watch the magic :)

For a full list of Markdown, please visit DaringFireball.net

markdown's People

Contributors

hyra avatar marcopeg avatar vaughany avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.