twigphp / Twig

Twig, the flexible, fast, and secure template language for PHP
https://twig.symfony.com/
BSD 3-Clause "New" or "Revised" License
8.08k stars 1.24k forks source link

html_to_markdown filter: Explain missing details #3357

Open ThomasLandauer opened 4 years ago

ThomasLandauer commented 4 years ago

Some suggestions/questions for https://twig.symfony.com/doc/2.x/filters/html_to_markdown.html. If you help me with answers, I'll come up with a PR:

1: twig/markdown-extra doesn't do any conversion itself; it just looks for a conversion library being present - see https://twig.symfony.com/doc/2.x/filters/html_to_markdown.html
Right?
And it also does not install one, if none is present?

2:

The options are the ones provided by the league/html-to-markdown package.

means that the above options only apply if you happen to have league/html-to-markdown installed. If you have one of the other converters, there are other options?

3: Which one is the "preferred" converter? league/html-to-markdown is explicitly mentioned both at https://twig.symfony.com/doc/2.x/filters/html_to_markdown.html and https://symfony.com/doc/master/mailer.html#text-content . However, in the very code, erusev/parsedown is the preferred, see https://github.com/twigphp/Twig/blob/3.x/extra/markdown-extra/src/DefaultMarkdown.php

4: What does this mean:

Then, use the twig/extra-bundle on Symfony projects

How am I supposed to "use" it? Does it just add some convenience (which?) or will it not work without it?

5: Do the other two converters work with Mailer as well, or really just league/html-to-markdown, as stated at https://symfony.com/doc/master/mailer.html#text-content ?

6: When Mailer uses league/html-to-markdown, is there a way to set options (see https://github.com/thephpleague/html-to-markdown#conversion-options )?

7: Why didn't you use Twig's html_to_markdown for Mailer as well (and include it into Twig core, instead of outsourcing it to twig/markdown-extra)?

Guite commented 4 years ago

Good questions!

About points 1 and 3 see also #3227.

ThomasLandauer commented 4 years ago

I started a PR at https://github.com/twigphp/Twig/pull/3361 - giving at least two answers ;-)

1: yes 4: will not work without it