aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/league
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/league')
-rw-r--r--vendor/league/html-to-markdown/CHANGELOG.md13
-rw-r--r--vendor/league/html-to-markdown/composer.json2
-rw-r--r--vendor/league/html-to-markdown/src/Converter/CodeConverter.php2
-rw-r--r--vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php14
-rw-r--r--vendor/league/html-to-markdown/src/Converter/LinkConverter.php2
-rw-r--r--vendor/league/html-to-markdown/src/Converter/ListItemConverter.php16
-rw-r--r--vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php2
-rw-r--r--vendor/league/html-to-markdown/src/HtmlConverter.php19
8 files changed, 63 insertions, 7 deletions
diff --git a/vendor/league/html-to-markdown/CHANGELOG.md b/vendor/league/html-to-markdown/CHANGELOG.md
index c3b7bf65b..981ffd594 100644
--- a/vendor/league/html-to-markdown/CHANGELOG.md
+++ b/vendor/league/html-to-markdown/CHANGELOG.md
@@ -4,6 +4,16 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
## [Unreleased][unreleased]
+## [4.7.0] - 2018-05-19
+### Added
+ - Added `setOptions()` function for chainable calling (#149)
+ - Added new `list_item_style_alternate` option for converting every-other list with a different character (#155)
+
+### Fixed
+ - Fixed insufficient newlines after code blocks (#144, #148)
+ - Fixed trailing spaces not being preserved in link anchors (#157)
+ - Fixed list-like lines not being escaped inside of lists items (#159)
+
## [4.6.2]
### Fixed
- Fixed issue with emphasized spaces (#146)
@@ -207,7 +217,8 @@ not ideally set, so this releases fixes that. Moving forwards this should reduce
### Added
- Initial release
-[unreleased]: https://github.com/thephpleague/html-to-markdown/compare/4.6.2...master
+[unreleased]: https://github.com/thephpleague/html-to-markdown/compare/4.7.0...master
+[4.7.0]: https://github.com/thephpleague/html-to-markdown/compare/4.6.2...4.7.0
[4.6.2]: https://github.com/thephpleague/html-to-markdown/compare/4.6.1...4.6.2
[4.6.1]: https://github.com/thephpleague/html-to-markdown/compare/4.6.0...4.6.1
[4.6.0]: https://github.com/thephpleague/html-to-markdown/compare/4.5.0...4.6.0
diff --git a/vendor/league/html-to-markdown/composer.json b/vendor/league/html-to-markdown/composer.json
index 8482b767c..c79230562 100644
--- a/vendor/league/html-to-markdown/composer.json
+++ b/vendor/league/html-to-markdown/composer.json
@@ -42,7 +42,7 @@
"bin": ["bin/html-to-markdown"],
"extra": {
"branch-alias": {
- "dev-master": "4.7-dev"
+ "dev-master": "4.8-dev"
}
}
}
diff --git a/vendor/league/html-to-markdown/src/Converter/CodeConverter.php b/vendor/league/html-to-markdown/src/Converter/CodeConverter.php
index c8ec2c005..e536362ee 100644
--- a/vendor/league/html-to-markdown/src/Converter/CodeConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/CodeConverter.php
@@ -43,7 +43,7 @@ class CodeConverter implements ConverterInterface
$lines = preg_split('/\r\n|\r|\n/', $code);
if (count($lines) > 1) {
// Multiple lines detected, adding three backticks and newlines
- $markdown .= '```' . $language . "\n" . $code . "\n" . '```';
+ $markdown .= '```' . $language . "\n" . $code . "\n" . '```' . "\n\n";
} else {
// One line of code, wrapping it on one backtick.
$markdown .= '`' . $language . $code . '`';
diff --git a/vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php b/vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php
index 37cd44e73..d079d9127 100644
--- a/vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php
@@ -28,7 +28,19 @@ class HardBreakConverter implements ConverterInterface, ConfigurationAwareInterf
*/
public function convert(ElementInterface $element)
{
- return $this->config->getOption('hard_break') ? "\n" : " \n";
+ $return = $this->config->getOption('hard_break') ? "\n" : " \n";
+
+ $next = $element->getNext();
+ if ($next) {
+ $next_value = $next->getValue();
+ if ($next_value) {
+ if (in_array(substr($next_value, 0, 2), array('- ', '* ', '+ '))) {
+ $return .= '\\';
+ }
+ }
+ }
+
+ return $return;
}
/**
diff --git a/vendor/league/html-to-markdown/src/Converter/LinkConverter.php b/vendor/league/html-to-markdown/src/Converter/LinkConverter.php
index f0765f38b..74b49a778 100644
--- a/vendor/league/html-to-markdown/src/Converter/LinkConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/LinkConverter.php
@@ -15,7 +15,7 @@ class LinkConverter implements ConverterInterface
{
$href = $element->getAttribute('href');
$title = $element->getAttribute('title');
- $text = trim($element->getValue());
+ $text = trim($element->getValue(), "\t\n\r\0\x0B");
if ($title !== '') {
$markdown = '[' . $text . '](' . $href . ' "' . $title . '")';
diff --git a/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php b/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php
index f737b4e19..c56ab89cd 100644
--- a/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php
@@ -14,6 +14,11 @@ class ListItemConverter implements ConverterInterface, ConfigurationAwareInterfa
protected $config;
/**
+ * @var string
+ */
+ protected $listItemStyle;
+
+ /**
* @param Configuration $config
*/
public function setConfig(Configuration $config)
@@ -45,7 +50,16 @@ class ListItemConverter implements ConverterInterface, ConfigurationAwareInterfa
if ($list_type === 'ul') {
$list_item_style = $this->config->getOption('list_item_style', '-');
- return $prefix . $list_item_style . ' ' . $value . "\n";
+ $list_item_style_alternate = $this->config->getOption('list_item_style_alternate');
+ if (!isset($this->listItemStyle)) {
+ $this->listItemStyle = $list_item_style_alternate ? $list_item_style_alternate : $list_item_style;
+ }
+
+ if ($list_item_style_alternate && $level == 0 && $element->getSiblingPosition() === 1) {
+ $this->listItemStyle = $this->listItemStyle == $list_item_style ? $list_item_style_alternate : $list_item_style;
+ }
+
+ return $prefix . $this->listItemStyle . ' ' . $value . "\n";
}
if ($list_type === 'ol' && $start = $element->getParent()->getAttribute('start')) {
diff --git a/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php b/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php
index 0bb89e90f..3b77ba10b 100644
--- a/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php
@@ -53,7 +53,7 @@ class PreformattedConverter implements ConverterInterface
}
// Use three backticks
- return "```\n" . $pre_content . "```\n";
+ return "```\n" . $pre_content . "```\n\n";
}
/**
diff --git a/vendor/league/html-to-markdown/src/HtmlConverter.php b/vendor/league/html-to-markdown/src/HtmlConverter.php
index 8d8936ec5..155369f56 100644
--- a/vendor/league/html-to-markdown/src/HtmlConverter.php
+++ b/vendor/league/html-to-markdown/src/HtmlConverter.php
@@ -229,4 +229,23 @@ class HtmlConverter
return trim($markdown, "\n\r\0\x0B");
}
+
+ /**
+ * Pass a series of key-value pairs in an array; these will be passed
+ * through the config and set.
+ * The advantage of this is that it can allow for static use (IE in Laravel).
+ * An example being:
+ *
+ * HtmlConverter::setOptions(['strip_tags' => true])->convert('<h1>test</h1>');
+ */
+ public function setOptions(array $options)
+ {
+ $config = $this->getConfig();
+
+ foreach ($options as $key => $option) {
+ $config->setOption($key, $option);
+ }
+
+ return $this;
+ }
}