Skip to main content

A HTML to Kirbytext converter

Project description

Build Status codecov

This is a html to Kirbytext converter for python.

It is currently in heavy development.


HTML2Kirby is tested and suported from Python 3.4 upwards

Install via pip:

pip install html2kirby


To use this package, simply import the package and feed it some html:

from html2kirby import HTML2Kirby

formatter = HTML2Kirby()
formatter.feed("""<img src="" alt="kittens are cute" />""")

You can then access the result via .kirbytext attribute:

# prints (image: alt: kittesn are cute)


Make sure you have Pytest installed (pip install pytest). Then just invoke it:


Supported Markup

As of now, following tags are supported:

  • Simple formatting (<b>, <strong>, <i>, <em>)
  • Headings (<h1>, <h2>, …)
  • Images (<img>)
  • line breaks (<br>)
  • Paragraphs (<p>)
  • Blocks (<pre>, <code>, <blockquote>, <pre><code>)
  • Links (<a>)
  • Horizontal rulers (<hr>)
  • Lists (<ul>, <ol>, <li>)

Passed markup

Markup tags that aren’t implemented are just dropped except for following tags:

  • table
  • tr
  • td
  • th
  • tbody
  • thead
  • strike
  • u
  • abbr
  • del
  • svg

They will just be kept in the Kirbytext which should result in a valid output.


In python3.4, the unescape doesn’t quite convert all of the html 5 escaped characters such as – (en dash).

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for html2kirby, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size html2kirby-0.2.tar.gz (5.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page