Reading — step 1 of 5
Read
~1 min readInline Elements
Bold and Italic
*italic* or _italic_ -> <em>italic</em>
**bold** or __bold__ -> <strong>bold</strong>
***bold italic*** -> <strong><em>bold italic</em></strong>
Tricky cases:
Surrounded by space? * not italic * — must touch text on both sides.
Mid-word? un*believ*able — works with * (asterisk-style emphasis is more permissive).
But un_believ_able does NOT work — underscores require word boundaries.
This intentional asymmetry: prevents accidental emphasis in code-like identifiers (some_long_name).
Nesting: *outer **inner** outer* mostly works but parser-dependent.
Implementation typically uses regex with lookarounds:
python
Real CommonMark spec is much more nuanced — gets emphasis right in 100+ edge cases.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…