and blocks to Markdown - that should stay as HTML
- if (self::is_child_of('pre', $node) || self::is_child_of('code', $node))
+ if (self::is_child_of(array('pre', 'code'), $node))
return;
// If the node has children, convert those to Markdown first
@@ -388,6 +391,9 @@ class HTML_To_Markdown
$markdown = '[' . $text . '](' . $href . ')';
}
+ if (! $href)
+ $markdown = html_entity_decode($node->C14N());
+
// Append a space if the node after this one is also an anchor
$next_node_name = $this->get_next_node_name($node);
@@ -437,7 +443,7 @@ class HTML_To_Markdown
$markdown = '';
- $code_content = html_entity_decode($this->document->saveHTML($node));
+ $code_content = html_entity_decode($node->C14N());
$code_content = str_replace(array("", "
"), "", $code_content);
$code_content = str_replace(array("", "
"), "", $code_content);
diff --git a/library/html-to-markdown/README.md b/library/html-to-markdown/README.md
index 124c9868a9..de91c9d08d 100644
--- a/library/html-to-markdown/README.md
+++ b/library/html-to-markdown/README.md
@@ -5,7 +5,7 @@ A helper class that converts HTML to [Markdown](http://daringfireball.net/projec
[](https://travis-ci.org/nickcernis/html-to-markdown)
-**Version**: 2.2.0
+**Version**: 2.2.1
**Requires**: PHP 5.3+
**Author**: [@nickcernis](http://twitter.com/nickcernis)
**License**: [MIT](http://www.opensource.org/licenses/mit-license.php)
diff --git a/library/html-to-markdown/circle.yml b/library/html-to-markdown/circle.yml
new file mode 100644
index 0000000000..9893a4b92d
--- /dev/null
+++ b/library/html-to-markdown/circle.yml
@@ -0,0 +1,4 @@
+test:
+ override:
+ - phpunit --no-configuration HTML_To_MarkdownTest ./tests/HTML_To_MarkdownTest.php
+
diff --git a/library/html-to-markdown/composer.json b/library/html-to-markdown/composer.json
new file mode 100644
index 0000000000..beb7faab4a
--- /dev/null
+++ b/library/html-to-markdown/composer.json
@@ -0,0 +1,25 @@
+{
+ "name": "nickcernis/html-to-markdown",
+ "type": "library",
+ "description": "An HTML-to-markdown conversion helper for PHP",
+ "keywords": ["markdown", "html"],
+ "homepage": "https://github.com/nickcernis/html-to-markdown",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Nick Cernis",
+ "email": "nick@cern.is",
+ "homepage": "http://modernnerd.net"
+ }
+ ],
+ "autoload": {
+ "classmap": [ "HTML_To_Markdown.php" ]
+ },
+ "require": {
+ "php": ">=5.3"
+ },
+ "require-dev": {
+ "php": ">=5.3.3",
+ "phpunit/phpunit": "4.*"
+ }
+}
diff --git a/library/parsedown/.travis.yml b/library/parsedown/.travis.yml
new file mode 100644
index 0000000000..7d782fe192
--- /dev/null
+++ b/library/parsedown/.travis.yml
@@ -0,0 +1,8 @@
+language: php
+
+php:
+ - 5.6
+ - 5.5
+ - 5.4
+ - 5.3
+ - hhvm
diff --git a/library/parsedown/composer.json b/library/parsedown/composer.json
new file mode 100644
index 0000000000..1439b824dd
--- /dev/null
+++ b/library/parsedown/composer.json
@@ -0,0 +1,18 @@
+{
+ "name": "erusev/parsedown",
+ "description": "Parser for Markdown.",
+ "keywords": ["markdown", "parser"],
+ "homepage": "http://parsedown.org",
+ "type": "library",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Emanuil Rusev",
+ "email": "hello@erusev.com",
+ "homepage": "http://erusev.com"
+ }
+ ],
+ "autoload": {
+ "psr-0": {"Parsedown": ""}
+ }
+}
\ No newline at end of file
diff --git a/library/parsedown/phpunit.xml.dist b/library/parsedown/phpunit.xml.dist
new file mode 100644
index 0000000000..b2d5e9d4fe
--- /dev/null
+++ b/library/parsedown/phpunit.xml.dist
@@ -0,0 +1,8 @@
+
+
+
+
+ test/ParsedownTest.php
+
+
+
\ No newline at end of file