aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/league/html-to-markdown
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2022-03-29 11:42:53 +0200
committerMario Vavti <mario@mariovavti.com>2022-03-29 11:42:53 +0200
commit0784cd593a39a4fc297e8a82f7e79bc8019a0868 (patch)
tree22182afb37cf460f8208fff9d276a0672add3185 /vendor/league/html-to-markdown
parent0e2e9321025f87fe9587f3d183adaea6185e4e20 (diff)
parent9c5d2ee5630dd7033904039dcd1e92db8821b644 (diff)
downloadvolse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.tar.gz
volse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.tar.bz2
volse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.zip
Merge branch '7.2RC'7.2
Diffstat (limited to 'vendor/league/html-to-markdown')
-rw-r--r--vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/1_Conversion_error.yaml25
-rw-r--r--vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/2_Bug_report.yaml43
-rw-r--r--vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/3_Feature_request.yaml27
-rw-r--r--vendor/league/html-to-markdown/CHANGELOG.md20
-rw-r--r--vendor/league/html-to-markdown/composer.json11
-rw-r--r--vendor/league/html-to-markdown/psalm.xml1
-rw-r--r--vendor/league/html-to-markdown/src/Converter/HorizontalRuleConverter.php2
-rw-r--r--vendor/league/html-to-markdown/src/Element.php2
-rw-r--r--vendor/league/html-to-markdown/src/HtmlConverter.php32
9 files changed, 156 insertions, 7 deletions
diff --git a/vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/1_Conversion_error.yaml b/vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/1_Conversion_error.yaml
new file mode 100644
index 000000000..7f267b208
--- /dev/null
+++ b/vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/1_Conversion_error.yaml
@@ -0,0 +1,25 @@
+name: "📃 Bug Report (Incorrect Markdown)"
+description: I'm not getting the Markdown I expect
+body:
+ - type: input
+ id: affected-versions
+ attributes:
+ label: Version(s) affected
+ placeholder: x.y.z
+ validations:
+ required: true
+ - type: textarea
+ id: description
+ attributes:
+ label: Description
+ description: A clear and concise description of the problem.
+ validations:
+ required: true
+ - type: textarea
+ id: how-to-reproduce
+ attributes:
+ label: How to reproduce
+ description: |
+ Provide the HTML input and any other information that would help us reproduce the problem.
+ validations:
+ required: true
diff --git a/vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/2_Bug_report.yaml b/vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/2_Bug_report.yaml
new file mode 100644
index 000000000..2045fb79a
--- /dev/null
+++ b/vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/2_Bug_report.yaml
@@ -0,0 +1,43 @@
+name: "🐛 Bug Report (Other)"
+description: Report all other errors and problems
+body:
+ - type: input
+ id: affected-versions
+ attributes:
+ label: Version(s) affected
+ placeholder: x.y.z
+ validations:
+ required: true
+ - type: textarea
+ id: description
+ attributes:
+ label: Description
+ description: A clear and concise description of the problem.
+ validations:
+ required: true
+ - type: textarea
+ id: how-to-reproduce
+ attributes:
+ label: How to reproduce
+ description: |
+ HTML and/or any other information needed to reproduce the problem.
+ validations:
+ required: true
+ - type: textarea
+ id: possible-solution
+ attributes:
+ label: Possible solution
+ description: |
+ Optional: only if you have suggestions on a fix/reason for the bug
+ - type: textarea
+ id: additional-context
+ attributes:
+ label: Additional context
+ description: |
+ Optional: any other context about the problem: log messages, screenshots, etc.
+ - type: textarea
+ id: feedback
+ attributes:
+ label: Did this project help you today? Did it make you happy in any way?
+ description: |
+ Optional: Sometimes we get tired of reading bug reports and working on complex features, so if you have anything positive to share about how this library might have helped you we'd love to hear it!
diff --git a/vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/3_Feature_request.yaml b/vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/3_Feature_request.yaml
new file mode 100644
index 000000000..2d91a58d0
--- /dev/null
+++ b/vendor/league/html-to-markdown/.github/ISSUE_TEMPLATE/3_Feature_request.yaml
@@ -0,0 +1,27 @@
+name: "🚀 Feature Request"
+description: RFC and ideas for new features and improvements
+labels:
+ - enhancement
+body:
+ - type: textarea
+ id: description
+ attributes:
+ label: Description
+ description: A clear and concise description of the problem.
+ validations:
+ required: true
+ - type: textarea
+ id: example
+ attributes:
+ label: Example
+ description: |
+ A simple example of the new feature in action (include PHP code, sample HTML/Markdown, etc.)
+ If the new feature changes an existing feature, include a simple before/after comparison.
+ validations:
+ required: true
+ - type: textarea
+ id: feedback
+ attributes:
+ label: Did this project help you today? Did it make you happy in any way?
+ description: |
+ Optional: Sometimes we get tired of reading bug reports and working on complex features, so if you have anything positive to share about how this library might have helped you we'd love to hear it!
diff --git a/vendor/league/html-to-markdown/CHANGELOG.md b/vendor/league/html-to-markdown/CHANGELOG.md
index 36fb1249e..60e8e6f24 100644
--- a/vendor/league/html-to-markdown/CHANGELOG.md
+++ b/vendor/league/html-to-markdown/CHANGELOG.md
@@ -4,6 +4,22 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
## [Unreleased][unreleased]
+## [5.1.0] - 2022-03-02
+
+### Changed
+
+ - Changed horizontal rule style (#218, #219)
+
+### Fixed
+
+ - Fixed `Element::getValue()` not handling possible nulls
+
+## [5.0.2] - 2021-11-06
+
+### Fixed
+
+ - Fixed missplaced comment nodes appearing at the start of the HTML input (#212)
+
## [5.0.1] - 2021-09-17
### Fixed
@@ -299,7 +315,9 @@ 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/5.0.1...master
+[unreleased]: https://github.com/thephpleague/html-to-markdown/compare/5.1.0...master
+[5.1.0]: https://github.com/thephpleague/html-to-markdown/compare/5.0.2...5.1.0
+[5.0.2]: https://github.com/thephpleague/html-to-markdown/compare/5.0.1...5.0.2
[5.0.1]: https://github.com/thephpleague/html-to-markdown/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/thephpleague/html-to-markdown/compare/4.10.0...5.0.0
[4.10.0]: https://github.com/thephpleague/html-to-markdown/compare/4.9.1...4.10.0
diff --git a/vendor/league/html-to-markdown/composer.json b/vendor/league/html-to-markdown/composer.json
index af3e41058..22ca054f3 100644
--- a/vendor/league/html-to-markdown/composer.json
+++ b/vendor/league/html-to-markdown/composer.json
@@ -36,16 +36,21 @@
},
"require-dev": {
"mikehaertl/php-shellcommand": "^1.1.0",
- "phpstan/phpstan": "^0.12.82",
+ "phpstan/phpstan": "^0.12.99",
"phpunit/phpunit": "^8.5 || ^9.2",
"scrutinizer/ocular": "^1.6",
"unleashedtech/php-coding-standard": "^2.7",
- "vimeo/psalm": "^4.6"
+ "vimeo/psalm": "^4.22"
},
"bin": ["bin/html-to-markdown"],
"extra": {
"branch-alias": {
- "dev-master": "5.1-dev"
+ "dev-master": "5.2-dev"
+ }
+ },
+ "config": {
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
diff --git a/vendor/league/html-to-markdown/psalm.xml b/vendor/league/html-to-markdown/psalm.xml
index 729e9a919..30258a709 100644
--- a/vendor/league/html-to-markdown/psalm.xml
+++ b/vendor/league/html-to-markdown/psalm.xml
@@ -1,6 +1,5 @@
<?xml version="1.0"?>
<psalm
- totallyTyped="false"
errorLevel="3"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
diff --git a/vendor/league/html-to-markdown/src/Converter/HorizontalRuleConverter.php b/vendor/league/html-to-markdown/src/Converter/HorizontalRuleConverter.php
index ce280cc79..a2b1ac14a 100644
--- a/vendor/league/html-to-markdown/src/Converter/HorizontalRuleConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/HorizontalRuleConverter.php
@@ -10,7 +10,7 @@ class HorizontalRuleConverter implements ConverterInterface
{
public function convert(ElementInterface $element): string
{
- return "- - - - - -\n\n";
+ return "---\n\n";
}
/**
diff --git a/vendor/league/html-to-markdown/src/Element.php b/vendor/league/html-to-markdown/src/Element.php
index 5407f1ffb..0515b5995 100644
--- a/vendor/league/html-to-markdown/src/Element.php
+++ b/vendor/league/html-to-markdown/src/Element.php
@@ -63,7 +63,7 @@ class Element implements ElementInterface
public function getValue(): string
{
- return $this->node->nodeValue;
+ return $this->node->nodeValue ?? '';
}
public function hasParent(): bool
diff --git a/vendor/league/html-to-markdown/src/HtmlConverter.php b/vendor/league/html-to-markdown/src/HtmlConverter.php
index 7cd543b34..7162b256d 100644
--- a/vendor/league/html-to-markdown/src/HtmlConverter.php
+++ b/vendor/league/html-to-markdown/src/HtmlConverter.php
@@ -121,6 +121,8 @@ class HtmlConverter implements HtmlConverterInterface
$document->loadHTML('<?xml encoding="UTF-8">' . $html);
$document->encoding = 'UTF-8';
+ $this->replaceMisplacedComments($document);
+
if ($this->getConfig()->getOption('suppress_errors')) {
\libxml_clear_errors();
}
@@ -129,6 +131,36 @@ class HtmlConverter implements HtmlConverterInterface
}
/**
+ * Finds any comment nodes outside <html> element and moves them into <body>.
+ *
+ * @see https://github.com/thephpleague/html-to-markdown/issues/212
+ * @see https://3v4l.org/7bC33
+ */
+ private function replaceMisplacedComments(\DOMDocument $document): void
+ {
+ // Find ny comment nodes at the root of the document.
+ $misplacedComments = (new \DOMXPath($document))->query('/comment()');
+ if ($misplacedComments === false) {
+ return;
+ }
+
+ $body = $document->getElementsByTagName('body')->item(0);
+ if ($body === null) {
+ return;
+ }
+
+ // Loop over comment nodes in reverse so we put them inside <body> in
+ // their original order.
+ for ($index = $misplacedComments->length - 1; $index >= 0; $index--) {
+ if ($body->firstChild === null) {
+ $body->insertBefore($misplacedComments[$index]);
+ } else {
+ $body->insertBefore($misplacedComments[$index], $body->firstChild);
+ }
+ }
+ }
+
+ /**
* Convert Children
*
* Recursive function to drill into the DOM and convert each node into Markdown from the inside out.