Skip to content

digitales/fuel-markdownify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Markdownify for FuelPHP

Introduction

"Markdown" is two things: a plain text markup syntax, and a software tool that converts the plain text to HTML for publishing on the web.

This package converts HTML markup to Markdown syntax. This allows for a more natural editing experience for content that may have been converted to HTML by a WYSIWYG (What You See Is What You Get) editor

Documentation

You can find the original markdown documentation here.

FuelPHP Usage

The markdown vendor package is used by FuelPHP in the Markdownify class, to convert from HTML to Markdown syntax.

Application Usage

You can access markdown through the Markdownify::parse() method.

Markdown Class

A plain text to HTML converter, originally by John Gruber.

parse($text)

Parses HTML and returns Markdown.

Static Yes
Parameters
Param Default Description
$text required Markdown text to parse.
Returns string

Example

$string = '<h1>About Markdown</h1>
<p>Markdown is a text-to-HTML conversion tool for web writers.
Markdown allows you to write using an easy-to-read, easy-to-write
plain text format, then convert it to structurally valid HTML.</p>
<ul>
<li>It features bullet points</li>
<li>As well as other handy features</li>
</ul>';

echo Markdown::parse($string);

Returns


# About Markdown

Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid HTML.

  • It features bullet points
  • As well as other handy features

Markdownify converts HTML Markup to Markdown (by John Gruber. It also supports Markdown Extra by Michel Fortin via Markdownify_Extra.

It all started as html2text.php - a port of Aaron Swartz' html2text.py - but got a long way since. This is far more than a mere port now!

Starting with version 2.0.0 this is a complete rewrite and cannot be compared to Aaron Swatz' html2text.py anylonger. I'm now using a HTML parser (see parsehtml.php which I also wrote) which makes most of the evil

RegEx magic go away and additionally it gives a much cleaner class structure. Also notably is the fact that I now try to prevent regressions by utilizing testcases of Michel Fortin's MDTest.

About

A markdownify package for FuelPHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published