Html to Markdown abstraction
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3534120. --> Reported by: [a.dmitriiev](https://www.drupal.org/user/3235287) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>At the moment HTML to markdown conversion is implemented with league/html-to-markdown package, that of course does its job really good, but it has a lot more to offer. There are settings on how the conversion is done, it is possible to add more tag converter, etc. At the moment the package is used "as is" with default (reasonable) settings.</p> <p>Even though league package is good, someone might want to use another tool or configure league package differently. Or in case of usage of web components, not all HTML tags can be converted properly to markdown, just because the package is not aware of them and their purpose.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Create abstraction layer that will allow to use any HTML to markdown conversion tool to the liking of a user. For example, there are already modules like <a href="https://www.drupal.org/project/markdownify">https://www.drupal.org/project/markdownify</a> that expose HTML to markdown feature as a service with pluggable structure, so that any tool can be used to convert markup to markdown with common interface. The league package is in the module out of the box. I assume there are also other modules.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>Discuss how the abstraction layer should be done: </p> <ul> <li>maybe possible usage of markdownify or some other module</li> <li>or plugin manager, so that other modules can implement plugins with ai module and overtake the conversion process</li> <li>....</li> </ul>
issue