Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
php-sundown is just simple wrapper of sundown
PHP C Perl Other

bumped up 0.3.11

fix segfault in sundown_render_base
latest commit 51c81f369d
@chobie authored
Failed to load latest commit information.
conformance_test adjust file structures as a standard PECL repo
docs fix #19 Autolink is broken for emails
examples added sample Man render.
sundown @ 37728fb update sundown library.
tests add readme and license
.gitignore improve build script.
.gitmodules change submodule to vmg/sundown from tanoku/sundown
.travis.yml add 5.5
CONTRIBUTORS move contributors section into file
CREDITS Correct encoding
Changelog oops, fixed typo
EXPERIMENTAL add EXPERIMENTAL.
LICENSE change license to PHP License from MIT.
README.md [ci skip] don't use development branch. I love github flow style
Rakefile remove needless gather task
buffer_win32_compat.patch improve patch
config.m4 don't apply patch when configure
config.w32 fixed config.w32
package.xml bumped up 0.3.11
php_sundown.c bumped up 0.3.9.
php_sundown.h bumped up 0.3.11
render_base.c fix segfault in sundown_render_base
render_html.c change email address
render_html_toc.c
render_xhtml.c change email address
sundown_markdown.c change email address

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.