---
# Feel free to add content and custom Front Matter to this file.
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults

title: html2text API demo
layout: home

# Local additions
h2t_wasm: true
h2t_js: "/assets/demo-main.js"
---

This demo page requires javascript (and WASM) to work.

An online demonstration of the
[`html2text`](https://github.com/jugglerchris/rust-html2text) Rust crate. Edit
the HTML below and see how `html2text` converts it for text or terminal
display.

This demo uses `html2text` compiled to WASM, which can run in any modern
browser, with [ratzilla](https://github.com/orhun/ratzilla) for the web-based
terminal output.

## Output

The html2text output is updated here:

Input HTML

Edit the HTML here - the output will update live.

Hi there
  
This is some simple text with a link to github (https://github.com/jugglerchris/html2text/)

- Item one
    
- Item two
    
- Item three

     Heading 1 Heading 2 Heading 3
     Data 1 Data 2 Data 3
     Hello there

## Configuration

The following are the configuration settings (accessible via [`html2text::config`](https://docs.rs/html2text/latest/html2text/config/struct.Config.html)).

| Use Rich output | The [`rich`](https://docs.rs/html2text/latest/html2text/config/fn.rich.html) mode returns spans with attributes (like hyperlinks, emphasis, or colours).  When disabled ([`plain`](https://docs.rs/html2text/latest/html2text/config/fn.plain.html)), the output is a plain `String` (possibly with formatting depending on other settings, e.g. table borders or `**markdown-style**` characters added).  Rich output adds extra information (annotations) to allow, for example, using terminal colours and other features for a nicer TUI.  |
| use_doc_css | Parse CSS from the HTML document (css) |
| User CSS | Add user stylesheet rules (css) |
| Agent CSS | Add browser stylesheet rules (css) |
| Pad block width | Pad blocks to the width with spaces |
| Text wrap width | Wrap text to this width even if overall width is wider |
| Allow width overflow | Allow text to be too wide in extreme cases instead of returning an error |
| Minimum wrap width | Set the minimum number of columns to use for text blocks. |
| Raw mode | Render contents of tables as if they were just text. Implies `no_table_borders` |
| Don't render table borders | Tables are shown without borders |
| Don't wrap URLs at the end | Some terminals handle long URLs better if not pre-wrapped |
| Use Unicode combining characters for strikeout | This allows crossed out text without terminal codes, but some environments don't render them correctly (e.g. offset). |
| Add markdown-like decoration | Add characters, e.g. `*` around `<em>` text even with plain decorators. |
| URL footnotes | Add numbered list of URLs at the end of the output |
| --Select mode--IgnoreEmptyShowAlwaysReplace(...)Filename | Configure how images with no `alt` text are handled |

## Rust API configuration

The code below shows how to use the currently selected settings in the Rust API.

