Altpub Content to HTML Converter
Convert LeanPub/Altpub markdown with aside sections (A>, W>, T>, E>, I>, Q>, D>, X>) into clean, semantic HTML instantly in your browser.
About
LeanPub and Altpub extend standard Markdown with prefixed aside blocks: A> for asides, W> for warnings, T> for tips, E> for errors, I> for informational notes, Q> for questions, D> for discussions, and X> for exercises. Most standard Markdown parsers silently discard or mangle these blocks because they don't conform to CommonMark or GFM blockquote syntax. This tool pre-parses LeanPub section markers, converts them to semantic HTML containers with appropriate class names, and processes the inner content as inline Markdown. It handles both the single-character prefix style (A> text) and the bracketed block style ({aside}...{/aside}). Limitations: nested aside blocks are flattened. Custom LeanPub attributes like {class: "foo"} are stripped.
Formulas
This tool does not perform mathematical computation. The core logic is a RegExp-driven line scanner that maps LeanPub prefix markers to HTML containers. The parsing rule for prefix-style blocks follows this pattern:
/^([AWTEIQDX])>\s?(.*)/Where line is each input line, the captured group 1 identifies the block type, and group 2 captures the content. Consecutive lines sharing the same prefix are accumulated into a single block. The inner content is then processed through inline Markdown rules:
/\*\*(.+?)\*\*/g, <strong>$1</strong>)For bracketed block syntax, the scanner detects opening tags like {aside} and closing tags like {/aside}. All content between them is collected and processed identically. The mapping from prefix character to HTML element and class is a static lookup table. Standard blockquotes using > are distinguished from LeanPub prefixes by the absence of an uppercase letter before the > symbol.
Reference Data
| Prefix | Block Type | HTML Output Element | CSS Class | LeanPub Docs Reference |
|---|---|---|---|---|
| A> | Aside / Sidebar | <aside> | aside | leanpub-auto-asidessidebars |
| W> | Warning | <div> | warning | leanpub-auto-warning |
| T> | Tip | <div> | tip | leanpub-auto-tip |
| E> | Error | <div> | error | leanpub-auto-error |
| I> | Information | <div> | information | leanpub-auto-information |
| Q> | Question | <div> | question | leanpub-auto-question |
| D> | Discussion | <div> | discussion | leanpub-auto-discussion |
| X> | Exercise | <div> | exercise | leanpub-auto-exercise |
| {aside} | Named Aside (block) | <aside> | aside | leanpub-auto-asidessidebars |
| {warning} | Named Warning (block) | <div> | warning | leanpub-auto-warning |
| {tip} | Named Tip (block) | <div> | tip | leanpub-auto-tip |
| {icon} | Icon block | <div> | icon | leanpub-auto-icons |
| > | Standard Blockquote | <blockquote> | - | Standard Markdown |
| # ## ### | Headings | <h1> - <h6> | - | Standard Markdown |
| **text** | Bold | <strong> | - | Standard Markdown |
| *text* | Italic | <em> | - | Standard Markdown |
| `code` | Inline Code | <code> | - | Standard Markdown |
| [text](url) | Link | <a> | - | Standard Markdown |
|  | Image | <img> | - | Standard Markdown |
| --- | Horizontal Rule | <hr> | - | Standard Markdown |
Frequently Asked Questions
element.
elements. The content inside the code fence is not processed for inline Markdown, preserving literal text. For bracketed blocks, fenced code between {aside} and {/aside} is handled identically.