Skip to content

markdown-inline

Handles inline formatting: bold, italic, bold italic, strikethrough, and inline code.

Details

PropertyValue
Namemarkdown-inline
Priority200
TypeInline
FactorymarkdownInline()

What It Handles

Bold

markdown
**bold text**
__bold text__

Renders as <strong>bold text</strong>.

Italic

markdown
*italic text*
_italic text_

Renders as <em>italic text</em>.

Bold Italic

markdown
***bold and italic***

Renders as <strong><em>bold and italic</em></strong>.

Strikethrough

markdown
~~deleted text~~

Renders as <del>deleted text</del>.

Inline Code

markdown
`inline code`
``code with `backtick` inside``

Renders as <code>inline code</code>. Content inside inline code is treated as raw text -- no further inline parsing occurs.

API

ts
import { markdownInline } from '@generative-dom/plugins';

const plugin = markdownInline();

No configuration options.

Nesting

Inline formatting can be nested:

markdown
**bold with *italic* inside**
*italic with **bold** inside*
**bold with `code` inside**
~~deleted with **bold** inside~~

Inline code cannot contain other formatting -- everything inside backticks is literal.

Edge Cases

  • Unmatched markers: A lone * or ** without a closing pair is treated as literal text.
  • Word boundaries: foo_bar_baz does not produce italic. Underscore emphasis requires non-word characters at the boundaries.
  • Empty emphasis: **** (empty bold) is treated as literal asterisks.
  • Overlapping markers: *foo **bar* baz** -- Generative DOM resolves ambiguity by matching the first valid pair.
  • Escaped markers: \*not italic\* is handled by the markdown-base plugin's escape logic.

Rendering

SyntaxOutput Element
**text** or __text__<strong>
*text* or _text_<em>
***text***<strong><em>
`code`<code>
~~text~~<del>