Skip to content

Commit 76501a8

Browse files
committed
Initial commit
0 parents  commit 76501a8

File tree

13 files changed

+3249
-0
lines changed

13 files changed

+3249
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor
2+
composer.lock

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: php
2+
php:
3+
- 5.3
4+
- 5.4
5+
before_script:
6+
- wget -nc http://getcomposer.org/composer.phar
7+
- php composer.phar update

LICENSE

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
PHP Markdown & Extra
2+
Copyright (c) 2011, Dragonfly Development Inc
3+
All rights reserved.
4+
5+
Based on PHP Markdown & Extra
6+
Copyright (c) 2004-2009 Michel Fortin
7+
<http://michelf.com/>
8+
All rights reserved.
9+
10+
Based on Markdown
11+
Copyright (c) 2003-2006 John Gruber
12+
<http://daringfireball.net/>
13+
All rights reserved.
14+
15+
Redistribution and use in source and binary forms, with or without
16+
modification, are permitted provided that the following conditions are
17+
met:
18+
19+
* Redistributions of source code must retain the above copyright notice,
20+
this list of conditions and the following disclaimer.
21+
22+
* Redistributions in binary form must reproduce the above copyright
23+
notice, this list of conditions and the following disclaimer in the
24+
documentation and/or other materials provided with the distribution.
25+
26+
* Neither the name "Markdown" nor the names of its contributors may
27+
be used to endorse or promote products derived from this software
28+
without specific prior written permission.
29+
30+
This software is provided by the copyright holders and contributors "as
31+
is" and any express or implied warranties, including, but not limited
32+
to, the implied warranties of merchantability and fitness for a
33+
particular purpose are disclaimed. In no event shall the copyright owner
34+
or contributors be liable for any direct, indirect, incidental, special,
35+
exemplary, or consequential damages (including, but not limited to,
36+
procurement of substitute goods or services; loss of use, data, or
37+
profits; or business interruption) however caused and on any theory of
38+
liability, whether in contract, strict liability, or tort (including
39+
negligence or otherwise) arising in any way out of the use of this
40+
software, even if advised of the possibility of such damage.

README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
PHP Markdown & Extra
2+
====================
3+
4+
An updated and stripped version of the original [PHP Markdown](http://michelf.com/projects/php-markdown/)
5+
by [Michel Fortin](http://michelf.com/). Works quite well with PSR-0
6+
autoloaders and is [Composer](http://packagist.org/) friendly.
7+
8+
9+
Changes from the official PHP Markdown & Extra
10+
----------------------------------------------
11+
12+
The initial pass at updating PHP Markdown & Extra left the core of
13+
the code more or less intact but the changes to the organization
14+
and naming were quite substantial. This effectively makes this package
15+
a hard fork from Markdown 1.0.1n and MarkdownExtra 1.2.4.
16+
17+
Updated in the following ways:
18+
19+
* Moved parser classes into their own files
20+
* Using PHP 5.3 namespaces
21+
* Following [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) standards
22+
* Replaced `@define` configuration variables with class `const` variables
23+
* Integrated with [Travis CI](http://travis-ci.org/)
24+
* Made [Composer](http://packagist.org/) friendly
25+
26+
Stripped in the following ways:
27+
28+
* No more embedded plugin code (WordPress, bBlog, etc.)
29+
* No more top level function calls (`Markdown()`, etc.)
30+
31+
32+
Requirements
33+
------------
34+
35+
* PHP 5.3+
36+
37+
38+
Usage
39+
-----
40+
41+
Simple usage for the standard Markdown ([details](http://michelf.com/projects/php-markdown/)) parser:
42+
43+
<?php
44+
use dflydev\markdown\Markdown;
45+
46+
$markdownParser = new MarkdownParser();
47+
48+
// Will return <h1>Hello World</h1>
49+
$markdownParser->transformMarkdown("#Hello World");
50+
51+
Simple usage for the Markdown Extra ([details](http://michelf.com/projects/php-markdown/extra/)) parser:
52+
53+
<?php
54+
use dflydev\markdown\MarkdownExtra;
55+
56+
$markdownParser = new MarkdownExtraParser();
57+
58+
// Will return <h1>Hello World</h1>
59+
$markdownParser->transformMarkdown("#Hello World");
60+
61+
62+
License
63+
-------
64+
65+
This library is licensed under the New BSD License - see the LICENSE file for details.
66+
67+
68+
Community
69+
---------
70+
71+
If you have questions or want to help out, join us in the
72+
[#dflydev](irc://irc.freenode.net/#dflydev) channel on irc.freenode.net.
73+
74+
75+
Not Invented Here
76+
-----------------
77+
78+
The original [PHP Markdown](http://michelf.com/projects/php-markdown/) was
79+
quite excellent but was not as easy to use as it could be in more modern PHP
80+
applications. Having started to use [Composer](http://packagist.org/) for a
81+
few newer applications that needed to transform Markdown, I decided to strip
82+
and update the original PHP Markdown so that it could be more easily managed
83+
by the likes of Composer.
84+
85+
All of the initial work done for this library (which I can only assume
86+
was quite substantial after having looked at the code) was done by
87+
[Michel Fortin](http://michelf.com/) during the original port from Perl to
88+
PHP.
89+
90+
If you do not need to install PHP Markdown by way of Composer or need to
91+
leverage PSR-0 autoloading, I suggest you continue to use the official and
92+
likely more stable and well used original version of
93+
[PHP Markdown](http://michelf.com/projects/php-markdown/)

composer.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "dflydev/markdown",
3+
"type": "library",
4+
"description": "PHP Markdown & Extra",
5+
"homepage": "http://github.com/dflydev/dflydev-markdown",
6+
"keywords": ["markdown"],
7+
"license": "New BSD License",
8+
"authors": [
9+
{
10+
"name": "Dragonfly Development Inc.",
11+
"email": "info@dflydev.com",
12+
"homepage": "http://dflydev.com"
13+
},
14+
{
15+
"name": "Beau Simensen",
16+
"email": "beau@dflydev.com",
17+
"homepage": "http://beausimensen.com"
18+
},
19+
{
20+
"name": "Michel Fortin",
21+
"homepage": "http://michelf.com"
22+
},
23+
{
24+
"name": "John Gruber",
25+
"homepage": "http://daringfireball.net"
26+
}
27+
],
28+
"require": {
29+
"php": ">=5.3"
30+
},
31+
"autoload": {
32+
"psr-0": { "dflydev\\markdown": "src" }
33+
}
34+
}

phpunit.xml.dist

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
colors="true"
5+
convertErrorsToExceptions="true"
6+
convertNoticesToExceptions="true"
7+
convertWarningsToExceptions="true"
8+
processIsolation="false"
9+
stopOnFailure="false"
10+
syntaxCheck="false"
11+
bootstrap="tests/bootstrap.php"
12+
>
13+
<testsuites>
14+
<testsuite name="dflydev-markdown Test Suite">
15+
<directory>./tests/dflydev/</directory>
16+
</testsuite>
17+
</testsuites>
18+
19+
<filter>
20+
<whitelist>
21+
<directory>./src/dflydev/</directory>
22+
<exclude>
23+
<directory>./src/dflydev/*/resources</directory>
24+
</exclude>
25+
</whitelist>
26+
</filter>
27+
</phpunit>
28+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/*
4+
* This file is a part of the PHP Markdown library.
5+
*
6+
* (c) Dragonfly Development Inc.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace dflydev\markdown;
13+
14+
interface IMarkdownParser {
15+
16+
/**
17+
* Transform Markdown text to HTML.
18+
* @param string $text
19+
* @return string
20+
*/
21+
public function transformMarkdown($text);
22+
23+
/**
24+
* Configure parser
25+
* @param string $key
26+
* @param mixed $value
27+
*/
28+
public function configureMarkdownParser($key, $value);
29+
30+
}

0 commit comments

Comments
 (0)