Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

php-sundown is just simple wrapper of sundown

bumped up 0.3.11

fix segfault in sundown_render_base
latest commit 51c81f369d
Shuhei Tanuma authored January 02, 2014
Octocat-spinner-32 conformance_test adjust file structures as a standard PECL repo January 14, 2012
Octocat-spinner-32 docs fix #19 Autolink is broken for emails May 16, 2012
Octocat-spinner-32 examples added sample Man render. January 08, 2012
Octocat-spinner-32 sundown @ 37728fb update sundown library. December 02, 2013
Octocat-spinner-32 tests add readme and license December 08, 2013
Octocat-spinner-32 .gitignore improve build script. May 14, 2012
Octocat-spinner-32 .gitmodules change submodule to vmg/sundown from tanoku/sundown August 04, 2012
Octocat-spinner-32 .travis.yml add 5.5 December 02, 2013
Octocat-spinner-32 CONTRIBUTORS move contributors section into file December 02, 2013
Octocat-spinner-32 CREDITS Correct encoding May 23, 2012
Octocat-spinner-32 Changelog oops, fixed typo June 02, 2012
Octocat-spinner-32 EXPERIMENTAL add EXPERIMENTAL. June 28, 2011
Octocat-spinner-32 LICENSE change license to PHP License from MIT. January 11, 2012
Octocat-spinner-32 README.md [ci skip] don't use development branch. I love github flow style December 03, 2013
Octocat-spinner-32 Rakefile remove needless gather task December 02, 2013
Octocat-spinner-32 buffer_win32_compat.patch improve patch December 09, 2013
Octocat-spinner-32 config.m4 don't apply patch when configure December 09, 2013
Octocat-spinner-32 config.w32 fixed config.w32 September 18, 2013
Octocat-spinner-32 package.xml bumped up 0.3.11 January 02, 2014
Octocat-spinner-32 php_sundown.c bumped up 0.3.9. December 08, 2013
Octocat-spinner-32 php_sundown.h bumped up 0.3.11 January 02, 2014
Octocat-spinner-32 render_base.c fix segfault in sundown_render_base December 15, 2013
Octocat-spinner-32 render_html.c change email address December 08, 2013
Octocat-spinner-32 render_html_toc.c use ZEND_STRS macro December 02, 2013
Octocat-spinner-32 render_xhtml.c change email address December 08, 2013
Octocat-spinner-32 sundown_markdown.c change email address December 08, 2013
README.md

PHP + Sundown

php-sundown is just simple wrapper of https://github.com/vmg/sundown.

Build Status

License

PHP License

THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Author: Shuhei Tanuma

Requirements

PHP5.3 higher

Install for developers

git clone https://github.com/chobie/php-sundown.git php-sundown --recursive
cd php-sundown
phpize
./configure
make
make install
# please add following line to your php.ini
# extension=sundown.so

Note for Windows users: sundown/src/buffer.h conflicts declarations. please apply buffer_win32_compat.patch by hand.

Conformance Testing

rake test:conformance

Overview

php-sundown has two styles: basic and advance.

basic: simple, fast rendering. advance: customize your own markdown render, little bit slower than basic.

\Sundown::__construct(string $str [, array $config])

Description

make a basic Sundown instance with specified string and config.

Parameters

str: you want parse and render as markdown html. config: sundown parser options

Return Value

\Sundown: sundown instance

Example
<?php
$sd = new Sundown("Hello World");
$sd->to_html();

\Sundown::toHTML()

Description

parse text as markdown and returns rendered html.

Parameters
Return Value

string: rendered html

Example
<?php
$sd = new Sundown("Hello World");
echo $sd->toHTML();

\Sundown::toTOC()

Description

parse text as markdown and only returns toc parts.

Parameters
Return Value

string: rendered html

Example
<?php
$sd = new Sundown("Hello World");
echo $sd->toTOC();

\Sundown\Markdown::__construct(\Sundown\Render\Base $render[, array $config])

Description

make a advance Sundown instance with specified render and config.

Parameters

$render: it inherits Sundown\Render\Base class. also class name accepts. $config: sundown parser option.

Return Value

\Sundown\Markdown:

Example
<?php
$md = new \Sundown\Markdown(\Sundown\Render\HTML);
echo $md->render("Hello World");

\Sundown\Markdown::render(string $str)

Description

parse and render specified string.

Parameters

$str: parse and render as markdown text.

Return Value

mixed: rendered something. (this depends render)

Example
<?php
$render = new \Sundown\Render\HTML();
$md = new \Sundown\Markdown($render);
echo $md->render("Hello World");n

\Sundown\Markdown::getExtensions()

Description

get current extensions.

Parameters
Return Value
  • array
Example
<?php
$md = new \Sundown\Markdown(\Sundown\Render\HTML,array("autolink"=>true));
$extensions = $md->getExtensions();
var_dump($extensions);

\Sundown\Markdown::setExtensions(array $extensions)

Description

set extensions.

Parameters

$extensions: extensions array.

Return Value
  • void
Example
<?php
$md = new \Sundown\Markdown(\Sundown\Render\HTML,array("autolink"=>true));
$md->setExtensions(array("autolink"=>false));
var_dump($md->getExtensions());

\Sundown\Markdown::getRender()

Description

get current render instance.

Parameters
Return Value
  • Sundown\Render\Base
Example
<?php
$md = new \Sundown\Markdown(\Sundown\Render\HTML,array("autolink"=>true));
$md->getRender()->setRenderFlags(array("filter_html"=>true));

\Sundown\Markdown::setRender(Sundown\Render\Base $render)

Description

set render instance.

Parameters

render: render instance

Return Value
  • void
Example
<?php
$md = new \Sundown\Markdown(\Sundown\Render\HTML,array("autolink"=>true));
$render2 = \Sundown\Render\HTML();
$md->setRender($render2);

\Sundown\Render\Base

documented at Render.md

Extensions and Render flags

documented at ExtensionsAndRenderFlags.md

Something went wrong with that request. Please try again.