thephpleague / html-to-markdown

Convert HTML to Markdown with PHP
MIT License
1.77k stars 205 forks source link

Del tags support #91

Closed Ilya-Zhulin closed 8 years ago

Ilya-Zhulin commented 8 years ago

Hello to all. How I can convert <del>strikethrough text</del> to ~~strikethrough text~~ with existing version of your Html-to-markdown component?

Thanks!

colinodell commented 8 years ago

Unfortunately we don't have any plans to support this tag as it's not part of the Commonmark specification. There has been some discussion on including it, but no official adoption yet: http://talk.commonmark.org/t/strikeout-threw-out-strikethrough-strikes-out-throughout/820/48

If that changes we will certainly include it.

On Thu, Feb 4, 2016, 3:11 AM Ilya A. Zhulin notifications@github.com wrote:

Hello to all How I can convert strikethrough text to strikethrough text with existing version of your Html-to-markdown component?

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/thephpleague/html-to-markdown/issues/91.

Ilya-Zhulin commented 8 years ago

OK, I understand that it's not native Markdown. To use it in League/Commonmark I programmed a plugin. Does Html-to-markdown support some plugins maybe? For now I added it to source code and it works (I can make a pull request), but it's not correct in my opinion... Thanks!

colinodell commented 8 years ago

Yep, simply create a new class which implements ConverterInterface. It has two methods:

  1. getSupportedTags() which should probably return ['del'].
  2. convert(ElementInterface $element) which converts the <del> HTML element into the resulting Markdown.