---
title: "💭 Alir3z4/html2text: Convert HTML to Markdown-formatted text."
description: "!https://github.com/Alir3z4/html2text"
date: 2024-05-01
published: true
tags:
  - thought
template: link
---


<div class="embed-card embed-card-external">
  <a href="https://github.com/Alir3z4/html2text" class="embed-card-link" target="_blank" rel="noopener noreferrer">
    <div class="embed-card-image">
      <img src="https://opengraph.githubassets.com/5029258963a688758e88dbdf68b8fdaeab1f0108974579b18bbdeb4230699ed9/Alir3z4/html2text" alt="GitHub - Alir3z4/html2text: Convert HTML to Markdown-formatted text. — Convert HTML to Markdown-formatted text. Contribute to Alir3z4/html2text development by creating an account on GitHub." loading="lazy">
    </div>
    <div class="embed-card-content">
      <div class="embed-card-title">GitHub - Alir3z4/html2text: Convert HTML to Markdown-formatted text.</div>
      <div class="embed-card-description">Convert HTML to Markdown-formatted text. Contribute to Alir3z4/html2text development by creating an account on GitHub.</div>
      <div class="embed-card-meta">GitHub &middot; github.com</div>
    </div>
  </a>
</div>


Super neat tool to convert html to markdown

``` python
>>> import html2text
>>>
>>> print(html2text.html2text("<p><strong>Zed's</strong> dead baby, <em>Zed's</em> dead.</p>"))
**Zed's** dead baby, _Zed's_ dead.
```

It even plays nicely with rich.

``` python
from rich.markdown import Markdown
from rich.console import Console
import html2text
console = Console()
md = Markdown(html2text.html2text("<p><strong>Zed's</strong> dead baby, <em>Zed's</em> dead.</p>"))
console.print(md)
``` 

!!! note

    This post is a <a href="/thoughts/" class="wikilink" data-title="Thoughts" data-description="These are generally my thoughts on a web page or some sort of url, except a rare few don&#39;t have a link. These are dual published off of my..." data-date="2024-04-01">thought</a>. It's a short note that I make
    about someone else's content online <a href="/tags/thoughts/" class="hashtag-tag" data-tag="thoughts" data-count=2 data-reading-time=3 data-reading-time-text="3 minutes">#thoughts</a>
