• Stars
    star
    137
  • Rank 266,121 (Top 6 %)
  • Language
    PHP
  • License
    Other
  • Created over 13 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

php-sundown is just simple wrapper of sundown

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

More Repositories

1

jira-api-restclient

php JIRA REST API
PHP
217
star
2

php-uv

libuv php extension
C
183
star
3

php-protocolbuffers

PECL ProtocolBuffers
C
128
star
4

protoc-gen-php

protoc plugin for PECL ProtocolBuffers
PHP
52
star
5

momonga

momonga - MQTT Server in golang -
Go
39
star
6

go-gaussian

Go
27
star
7

php-mruby

Wow, this php performs mruby!
C
19
star
8

Emoji

like a github, cutest emoji parser & render
PHP
18
star
9

php-rtb-server

PHP
17
star
10

influxdb-monitor

Go
12
star
11

ChobieDB

C++
8
star
12

php-httpparser

joyent's http parser for php
C
7
star
13

skiplist

Go
7
star
14

chatwork-api-client

unofficial, but glittering chatwork api client.
PHP
7
star
15

alpaca-webkit

alpaca is great toolkit for web develop which use capybara-webkit's webkit_server
PHP
6
star
16

hhvm-uv

libuv extension for hhvm
C++
5
star
17

git-asset

git-asset is yet another implementation of git-media
Ruby
5
star
18

php-plist

PHP
4
star
19

Git2RepositoryBrowserBundle

PHP
4
star
20

kokuban

yet another gist implementation using php-git2
PHP
4
star
21

githq

Suck fast git integrated project tracker. below site are registered developer only please pin me if you wanna try it
PHP
4
star
22

php-influxdb

(WIP)Experimental Protobuf Client / HTTP client for influxdb
PHP
3
star
23

php-websocketframe

provides really fast websocket frame decoder / encoder for php
C
3
star
24

fluent-plugin-delayed

Delayed output plugin for Fluent event collector
Ruby
3
star
25

dabloomd

dablooms * memcached like server
PHP
3
star
26

treasuredata-api-client

PHP
3
star
27

mod_log_fluentd

experimental logger
C
3
star
28

Git_Util

PHP
2
star
29

Git2RepositoryBrowserBundleSandbox

PHP
2
star
30

chobot

C++
2
star
31

php-git-sample

php-git sample application
PHP
2
star
32

VertexPaintExample

C#
2
star
33

judgement

ใ‚ธใƒฃใƒƒใ‚ธใƒกใƒณใƒˆใงใ™ใฎ๏ผ
PHP
2
star
34

gtfs-realtime-example

example
PHP
2
star
35

skype_bouncer

bounce skype messages to irc. this is a rough sketch.
C
1
star
36

VersionSorter

PHP
1
star
37

RacerX

RacerX - Ultimate PHP event driven framework - (this is a joke)
1
star
38

php-migemo

php-migemo is a set of PHP 5.3+ bindings to the C/Migemo linkable C library.
C
1
star
39

Albino

pygmentize wrapper for php
PHP
1
star
40

alpaca

PHP
1
star
41

gyazo-server

PHP
1
star
42

threeway_merge

php threeway merge
PHP
1
star
43

bkg

php git2 command line tool
PHP
1
star
44

go-chatwork

Go
1
star
45

php-nanoirc

php-nanoirc binding
C++
1
star
46

example-influxdb-binary-protocol-client

JUST EXAMPLE REPO
Go
1
star
47

tp_runner

multi threaded texturepacker runner
C#
1
star
48

Servant

manages jenkins job with ruby DSL
Ruby
1
star
49

go-anomalydetector

Go
1
star
50

Symfony2VagrantSandbox

just snapshoted
PHP
1
star
51

hhvm-websocketframe

C++
1
star