Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Add support for both CommonMark 1.x and 2.x #37954

Merged
merged 1 commit into from
Jul 9, 2021

Conversation

colinodell
Copy link
Contributor

This PR complements #37953 by allowing users of 8.x to install either major version of the CommonMark library.

@@ -22,7 +22,7 @@
"doctrine/inflector": "^1.4|^2.0",
"dragonmantank/cron-expression": "^3.0.2",
"egulias/email-validator": "^2.1.10",
"league/commonmark": "^1.3",
"league/commonmark": "^1.3|^2.0",
Copy link
Contributor Author

@colinodell colinodell Jul 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically you'll want ^1.3|^2.0.0-beta3, as the type hints in the first two betas do not support $converter->getEnvironment()->addExtension() as used below.

src/Illuminate/Mail/Markdown.php Show resolved Hide resolved

return new HtmlString($converter->convertToHtml($text));
return new HtmlString((string) $converter->convertToHtml($text));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 1.x the convertToHtml() method returns a string. In 2.x it returns a Stringable object. Casting the output to a string allows us to support both.

@colinodell colinodell marked this pull request as draft July 8, 2021 15:55
@driesvints
Copy link
Member

I'll make the adjustments to require CommonMark v2 on Laravel v9 after this is merged upstream 👍

@colinodell colinodell marked this pull request as ready for review July 8, 2021 18:20
@taylorotwell taylorotwell merged commit 7a82103 into laravel:8.x Jul 9, 2021
@taylorotwell
Copy link
Member

Thanks @colinodell

@colinodell colinodell deleted the allow-commonmark-v2 branch July 9, 2021 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants