Convert HTML Bold and Italic to Markdown Emphasis
Convert HTML <strong>, <b>, <em>, and <i> tags to Markdown bold (**) and italic (*) syntax. Covers nested emphasis, combined bold-italic, and edge cases.
Detailed Explanation
HTML Bold and Italic to Markdown
HTML uses <strong> / <b> for bold text and <em> / <i> for italic text. In Markdown, these map to double asterisks (**) and single asterisks (*) respectively.
Bold Conversion
<p>This is <strong>strongly emphasized</strong> text.</p>
<p>This is <b>bold</b> text.</p>
Converts to:
This is **strongly emphasized** text.
This is **bold** text.
Both <strong> and <b> produce the same Markdown output with ** wrappers. While semantically different in HTML (<strong> indicates importance, <b> is presentational), Markdown does not distinguish between them.
Italic Conversion
<p>This is <em>emphasized</em> text.</p>
<p>This is <i>italic</i> text.</p>
Converts to:
This is *emphasized* text.
This is *italic* text.
Combined Bold and Italic
<p>This is <strong><em>bold and italic</em></strong> text.</p>
Converts to:
This is ***bold and italic*** text.
Triple asterisks combine both emphasis levels.
Nested Emphasis
<p><em>This is italic with <strong>bold inside</strong> it</em></p>
Converts to:
*This is italic with **bold inside** it*
Edge Cases
- Empty tags:
<strong></strong>should produce no output (no empty****). - Whitespace:
<strong> text </strong>— leading/trailing spaces should be moved outside the markers:**text**. - Inline within words: Some converters use underscores (
_) for italic to avoid ambiguity when emphasis markers appear mid-word.
Use Case
Bold and italic conversion is needed in virtually every HTML-to-Markdown migration. Whether you are converting CMS content, rich text editor output, or copied HTML from web pages, correct emphasis handling ensures the Markdown retains the visual and semantic emphasis of the original.
Try It — HTML to Markdown
Related Topics
Convert HTML Paragraphs to Markdown Text
Basic Conversion
Convert HTML Links and Images to Markdown Syntax
Media & Links
Handle HTML Inline Styles in Markdown Conversion
Text Formatting
Convert Deeply Nested HTML to Clean Markdown
Real-World HTML
Decode HTML Entities During Markdown Conversion
Real-World HTML