-
Notifications
You must be signed in to change notification settings - Fork 138
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
Adding an HTML to Markdown parser/converter (html2md) #240
Comments
This same request came up not too long ago: #180. |
That sounds complicated (because HTML is complicated, in general), unless you mean that only a subset should be supported. But if you have a use for Qt for some other purpose (typically for a portable GUI), you can use https://doc.qt.io/qt-6/qtextdocument.html#setHtml and then https://doc.qt.io/qt-6/qtextdocument.html#toMarkdown. Qt's HTML parser also only supports a subset. But it works ok for writing a wysiwyg "rich text" editor or viewer. If other libraries already do this conversion, why duplicate effort? A comment on #180 does indeed link to another alternative (which I haven't tried). There are also plenty of xml parsers already, which could be pressed into service for this purpose. |
Other libraries exist also for Markdown to HTML conversion, but we all are
using md4c for a reason. And that's because of its extreme speed and
elegance of implementation. So the conversion into opposite direction
(html2md) will have the same advantages.
And yes - I indeed meant to parse/convert only a subset of the entire HTML.
Exactly that subset that is generated by library's md2html. Imagine that
you have rendered HTML of an document but the source was lost over time and
you want to edit that document. In such a case you need a tool that will
produce you the source Markdown doc.
…On Tue, Feb 13, 2024 at 2:29 AM Shawn Rutledge ***@***.***> wrote:
That sounds complicated (because HTML is complicated, in general), unless
you mean that only a subset should be supported. But if you have a use for
Qt for some other purpose (typically for a portable GUI), you can use
https://doc.qt.io/qt-6/qtextdocument.html#setHtml and then
https://doc.qt.io/qt-6/qtextdocument.html#toMarkdown. Qt's HTML parser
also only supports a subset. But it works ok for writing a wysiwyg "rich
text" editor or viewer.
If other libraries already do this conversion, why duplicate effort? A
comment on #180 <#180> does indeed
link to another alternative (which I haven't tried). There are also plenty
of xml parsers already, which could be pressed into service for this
purpose.
—
Reply to this email directly, view it on GitHub
<#240 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC6NCKZSKHPZ7Y427NF3UW3YTKXXDAVCNFSM6AAAAABDE4PYWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZZHA3DSNZUHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
An alternative html to markdown converter is |
If anybody wants to contribute such code, I'm open to consider incorporating it into the tree. But I have no plans working on this myself. |
Please add also an HTML to Markdown parser/converter (html2md) and thank you for the great software!
The text was updated successfully, but these errors were encountered: