6.3.0
2363c39 exclusively inline returns should be wrapped in a span, not p
1ccf119 handle empty input
2baf46a add forceBlock and forceInline parsing options
By default, the compiler will try to make an intelligent guess
about the content passed and wrap it in a <div>
, <p>
, or
<span>
as needed to satisfy the "inline"-ness of the markdown.
For instance, this string would be considered "inline":
Hello. _Beautiful_ day isn't it?
But this string would be considered "block" due to the existence of
a header tag, which is a block-level HTML element:
# Whaddup?
However, if you really want all input strings to be treated
as "block" layout, simply pass options.forceBlock = true
like this:
<Markdown options={{ forceBlock: true }}>
Hello there old chap!
</Markdown>
// or
compiler('Hello there old chap!', { forceBlock: true });
// renders
<p>Hello there old chap!</p>
The inverse is also available by passing options.forceInline = true
:
<Markdown options={{ forceInline: true }}>
# You got it babe!
</Markdown>
// or
compiler('# You got it babe!', { forceInline: true });
// renders
<span># You got it babe!</span>