HTML to Textile Converter
Convert HTML markup to Textile format instantly. Supports tables, lists, links, images, headings, and inline styles for Redmine and other Textile-based systems.
About
Textile is a lightweight markup language used by platforms like Redmine, Textpattern, and legacy CMS installations. Manual conversion from HTML to Textile is error-prone: a misplaced pipe character breaks table rendering, an unclosed block modifier corrupts downstream formatting, and nested list indentation follows strict whitespace rules that differ from HTML's recursive ul/ol nesting. This converter parses your HTML into a DOM tree using the browser's native DOMParser, then performs a recursive depth-first traversal to emit correct Textile syntax for every supported element. It handles block constructs (headings h1 - h6, paragraphs, blockquotes, preformatted blocks, horizontal rules, ordered and unordered lists, and tables with header rows) and inline constructs (bold, italic, deleted, inserted, superscript, subscript, inline code, links, and images). Note: this tool approximates CSS style attributes where possible (e.g., text-align and color on block elements) but cannot replicate arbitrary CSS in Textile's limited style syntax. Deeply nested or malformed HTML may produce imperfect output requiring manual review.
Formulas
The conversion algorithm performs a depth-first recursive traversal of the parsed DOM tree. For each node, the logic follows:
Where depth tracks nesting level for lists (each level adds one * or # prefix character). The blockMap function prepends the Textile block modifier (e.g., h2. ) and appends a trailing blank line. The inlineWrap function surrounds recursed child content with the appropriate Textile delimiter pair (e.g., *…* for bold). Whitespace normalization collapses runs of >2 consecutive newlines into exactly 2.
Reference Data
| HTML Element | Textile Syntax | Example Output | Notes |
|---|---|---|---|
| <h1> - <h6> | h1. - h6. | h1. Heading | Block-level, followed by blank line |
| <p> | p. (or plain text) | p. Paragraph text | Emitted as plain text when no attributes |
| <strong> / <b> | *text* | *bold* | Inline bold marker |
| <em> / <i> | _text_ | _italic_ | Inline emphasis marker |
| <del> / <s> | -text- | -deleted- | Strikethrough |
| <ins> | +text+ | +inserted+ | Underline / inserted text |
| <sup> | ^text^ | ^superscript^ | Superscript |
| <sub> | ~text~ | ~subscript~ | Subscript |
| <code> | @text@ | @inline code@ | Inline code |
| <pre> | bc. or <pre> | bc. code block | Block code, preserves whitespace |
| <blockquote> | bq. | bq. quoted text | Block quotation |
| <a href> | "text":url | "link":http://example.com | Anchor with href |
| <img src> | !url! | !image.png! | Alt text: !url(alt)! |
| <ul> / <li> | * item | * item | Nested: ** sub-item |
| <ol> / <li> | # item | # item | Nested: ## sub-item |
| <table> | |cell|cell| | |data|data| | Rows separated by newlines |
| <th> | |_. header| | |_. Name|_. Value| | Header cell prefix |
| <hr> | --- | --- | Horizontal rule |
| <br> | \n | Line break | Newline character in output |
| <span> with style | %{style}text% | %{color:red}text% | Inline style span |
| <cite> | ??text?? | ??citation?? | Citation marker |
| <acronym> / <abbr> | ABC(Full Name) | HTML(HyperText Markup Language) | With title attribute |