Initial release of HTML to markdown Clojure library
After pausing for almost a year, circumstances pushed me to finish development on a Clojure library for converting HTML to markdown, and I recently released version 0.8.1… just to realize that it was irrelevant.
The kick I needed to pick up development again came during AI development with ECA, where I was annoyed by:
- The necessity to use shell commands (
curl) to fetch website content. Reaching for the shell should be the absolute last resort — it is way too powerful for such a trivial task. - The token waste of sending raw HTML, when the relevant content usually requires significantly fewer tokens.
Even though I searched for other projects solving the same problem before resuming development, I didn’t find r11y which actually mostly overlaps. The scope of r11y is slightly bigger and includes several things for convenience, like being a CLI tool and including a workaround for github.com, which is client-side rendered and thus normally won’t contain usable HTML.
At the time of release, html-to-md actually handled complex nested structures better:
<ul>
<li>Apple</li>
<li>Banana
<ol>
<li>The <code>yellow</code> one.</li>
<li><div><blockquote><p>A <em>sunflower</em> would
<span style="color:purple;">be jealous</span>.
</p><p><strong>Even</strong><br>the sun.</p></blockquote></div></li>
</ol>
</li>
<li>Kiwi</li>
</ul>
which converts into the following, with some clever use of infinite sequences:
- Apple
- Banana
1. The `yellow` one.
2. > A _sunflower_ would be jealous.
>
> **Even**
> the sun.
- Kiwi
Whereas r11y would return:
- Apple
- Banana - The `yellow` one.
- > A *sunflower* would be jealous.
>
> **Even**
> the sun.
>
>
- Kiwi
But this has since been fixed 🚀
So now the only positive impact of html-to-md is the fact that a related bug in Hickory got fixed, thanks borkdude 🙏
… and maybe a smaller implementation (450 vs 1500 lines of code) if you find that interesting. 🤷 I am pretty happy with the “clever” use of infinite sequences for the nested elements (like lists inside blockquotes inside lists).
Peace out 💚