aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/league
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/league')
-rw-r--r--vendor/league/html-to-markdown/CHANGELOG.md25
-rw-r--r--vendor/league/html-to-markdown/README.md8
-rw-r--r--vendor/league/html-to-markdown/composer.json2
-rw-r--r--vendor/league/html-to-markdown/src/Converter/EmphasisConverter.php2
-rw-r--r--vendor/league/html-to-markdown/src/Converter/ListItemConverter.php26
-rw-r--r--vendor/league/html-to-markdown/src/Converter/ParagraphConverter.php3
-rw-r--r--vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php23
-rw-r--r--vendor/league/html-to-markdown/src/HtmlConverter.php3
8 files changed, 72 insertions, 20 deletions
diff --git a/vendor/league/html-to-markdown/CHANGELOG.md b/vendor/league/html-to-markdown/CHANGELOG.md
index 067864412..c3b7bf65b 100644
--- a/vendor/league/html-to-markdown/CHANGELOG.md
+++ b/vendor/league/html-to-markdown/CHANGELOG.md
@@ -4,6 +4,25 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
## [Unreleased][unreleased]
+## [4.6.2]
+### Fixed
+ - Fixed issue with emphasized spaces (#146)
+
+## [4.6.1]
+### Fixed
+ - Fixed conversion of `<pre>` tags (#145)
+
+## [4.6.0]
+### Added
+ - Added support for ordered lists starting at numbers other than 1
+
+### Fixed
+ - Fixed overly-eager escaping of list-like text (#141)
+
+## [4.5.0]
+### Added
+ - Added configuration option for list item style (#135, #136)
+
## [4.4.1]
### Fixed
@@ -188,7 +207,11 @@ 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.4.1...master
+[unreleased]: https://github.com/thephpleague/html-to-markdown/compare/4.6.2...master
+[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
+[4.5.0]: https://github.com/thephpleague/html-to-markdown/compare/4.4.1...4.5.0
[4.4.1]: https://github.com/thephpleague/html-to-markdown/compare/4.4.0...4.4.1
[4.4.0]: https://github.com/thephpleague/html-to-markdown/compare/4.3.1...4.4.0
[4.3.1]: https://github.com/thephpleague/html-to-markdown/compare/4.3.0...4.3.1
diff --git a/vendor/league/html-to-markdown/README.md b/vendor/league/html-to-markdown/README.md
index 8d75649d6..ab80541e6 100644
--- a/vendor/league/html-to-markdown/README.md
+++ b/vendor/league/html-to-markdown/README.md
@@ -13,7 +13,7 @@ HTML To Markdown for PHP
Library which converts HTML to [Markdown](http://daringfireball.net/projects/markdown/) for your sanity and convenience.
-**Requires**: PHP 5.3+
+**Requires**: PHP 5.3+ or PHP 7.0+
**Lead Developer**: [@colinodell](http://twitter.com/colinodell)
@@ -97,15 +97,15 @@ $markdown = $converter->convert($html); // $markdown now contains ""
### Style options
-Bold and italic tags are converted using the asterisk syntax by default. Change this to the underlined syntax using the `bold_style` and `italic_style` options.
+By default bold tags are converted using the asterisk syntax, and italic tags are converted using the underlined syntax. Change these by using the `bold_style` and `italic_style` options.
```php
$converter = new HtmlConverter();
-$converter->getConfig()->setOption('italic_style', '_');
+$converter->getConfig()->setOption('italic_style', '*');
$converter->getConfig()->setOption('bold_style', '__');
$html = '<em>Italic</em> and a <strong>bold</strong>';
-$markdown = $converter->convert($html); // $markdown now contains "_Italic_ and a __bold__"
+$markdown = $converter->convert($html); // $markdown now contains "*Italic* and a __bold__"
```
### Line break options
diff --git a/vendor/league/html-to-markdown/composer.json b/vendor/league/html-to-markdown/composer.json
index 58764bcb5..8482b767c 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.5-dev"
+ "dev-master": "4.7-dev"
}
}
}
diff --git a/vendor/league/html-to-markdown/src/Converter/EmphasisConverter.php b/vendor/league/html-to-markdown/src/Converter/EmphasisConverter.php
index 67250769b..8fd4dd6e2 100644
--- a/vendor/league/html-to-markdown/src/Converter/EmphasisConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/EmphasisConverter.php
@@ -32,7 +32,7 @@ class EmphasisConverter implements ConverterInterface, ConfigurationAwareInterfa
$value = $element->getValue();
if (!trim($value)) {
- return '';
+ return $value;
}
if ($tag === 'i' || $tag === 'em') {
diff --git a/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php b/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php
index dafec077c..f737b4e19 100644
--- a/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/ListItemConverter.php
@@ -2,11 +2,26 @@
namespace League\HTMLToMarkdown\Converter;
+use League\HTMLToMarkdown\Configuration;
+use League\HTMLToMarkdown\ConfigurationAwareInterface;
use League\HTMLToMarkdown\ElementInterface;
-class ListItemConverter implements ConverterInterface
+class ListItemConverter implements ConverterInterface, ConfigurationAwareInterface
{
/**
+ * @var Configuration
+ */
+ protected $config;
+
+ /**
+ * @param Configuration $config
+ */
+ public function setConfig(Configuration $config)
+ {
+ $this->config = $config;
+ }
+
+ /**
* @param ElementInterface $element
*
* @return string
@@ -29,10 +44,15 @@ class ListItemConverter implements ConverterInterface
}
if ($list_type === 'ul') {
- return $prefix . '- ' . $value . "\n";
+ $list_item_style = $this->config->getOption('list_item_style', '-');
+ return $prefix . $list_item_style . ' ' . $value . "\n";
}
- $number = $element->getSiblingPosition();
+ if ($list_type === 'ol' && $start = $element->getParent()->getAttribute('start')) {
+ $number = $start + $element->getSiblingPosition() - 1;
+ } else {
+ $number = $element->getSiblingPosition();
+ }
return $prefix . $number . '. ' . $value . "\n";
}
diff --git a/vendor/league/html-to-markdown/src/Converter/ParagraphConverter.php b/vendor/league/html-to-markdown/src/Converter/ParagraphConverter.php
index cf852bfcf..7207b81a6 100644
--- a/vendor/league/html-to-markdown/src/Converter/ParagraphConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/ParagraphConverter.php
@@ -109,7 +109,8 @@ class ParagraphConverter implements ConverterInterface
{
$regExs = array(
// Match numbers ending on ')' or '.' that are at the beginning of the line.
- '/^[0-9]+(?=\)|\.)/'
+ // They will be escaped if immediately followed by a space or newline.
+ '/^[0-9]+(?=(\)|\.)( |$))/'
);
foreach ($regExs as $i) {
diff --git a/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php b/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php
index 7a4ec3357..0bb89e90f 100644
--- a/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php
@@ -33,20 +33,27 @@ class PreformattedConverter implements ConverterInterface
// If the execution reaches this point it means it's just a pre tag, with no code tag nested
+ // Empty lines are a special case
+ if ($pre_content === '') {
+ return "```\n```\n";
+ }
+
// Normalizing new lines
$pre_content = preg_replace('/\r\n|\r|\n/', PHP_EOL, $pre_content);
- // Checking if the string has multiple lines
- $lines = preg_split('/\r\n|\r|\n/', $pre_content);
- if (count($lines) > 1) {
- // Multiple lines detected, adding three backticks and newlines
- $markdown .= '```' . "\n" . $pre_content . "\n" . '```';
- } else {
+ // Is it a single line?
+ if (strpos($pre_content, PHP_EOL) === false) {
// One line of code, wrapping it on one backtick.
- $markdown .= '`' . $pre_content . '`';
+ return '`' . $pre_content . '`';
+ }
+
+ // Ensure there's a newline at the end
+ if (strrpos($pre_content, PHP_EOL) !== strlen($pre_content) - 1) {
+ $pre_content .= PHP_EOL;
}
- return $markdown;
+ // Use three backticks
+ return "```\n" . $pre_content . "```\n";
}
/**
diff --git a/vendor/league/html-to-markdown/src/HtmlConverter.php b/vendor/league/html-to-markdown/src/HtmlConverter.php
index db3c29e1c..8d8936ec5 100644
--- a/vendor/league/html-to-markdown/src/HtmlConverter.php
+++ b/vendor/league/html-to-markdown/src/HtmlConverter.php
@@ -38,7 +38,8 @@ class HtmlConverter
'bold_style' => '**', // Set to '__' if you prefer the underlined style
'italic_style' => '_', // Set to '*' if you prefer the asterisk style
'remove_nodes' => '', // space-separated list of dom nodes that should be removed. example: 'meta style script'
- 'hard_break' => false,// Set to true to turn <br> into `\n` instead of ` \n`
+ 'hard_break' => false, // Set to true to turn <br> into `\n` instead of ` \n`
+ 'list_item_style' => '-', // Set the default character for each <li> in a <ul>. Can be '-', '*', or '+'
);
$this->environment = Environment::createDefaultEnvironment($defaults);