``` *foo bar* .

foo bar

``` ``` a* foo bar* .

a* foo bar*

``` ``` *foo bar * .

*foo bar *

``` Unicode spaces don't block emphasis. ``` * a * .

 a 

``` Intraword: ``` foo*bar*baz .

foobarbaz

``` ``` _foo bar_ .

foo bar

``` ``` _ foo bar_ .

_ foo bar_

``` ``` _foo bar _ .

_foo bar _

``` Unicode spaces don't block emphasis. ``` _ a _ .

 a 

``` Intraword: ``` foo_bar_baz .

foobarbaz

``` ``` aa_"bb"_cc .

aa“bb”cc

``` ``` *foo_ .

*foo_

``` ``` _foo* .

_foo*

``` A line ending counts as whitespace: ``` _foo bar _ .

_foo bar _

``` So does a tab: ``` _ a_ .

_ a_

``` This one is different from commonmark: ``` _(_foo_)_ .

(foo)

``` But you can force the second `_` to be an opener using the marker `{`. ``` _({_foo_})_ .

(foo)

``` Note that an explicitly marked opener can only be closed by an explicitly marked closer, and a non-marked opener can only be closed by a non-marked closer: ``` {_ x_ _} _x_} .

x_ _x_}

``` ``` _(*foo*)_ .

(foo)

``` Overlapping scopes (first to close wins): ``` _foo *bar_ baz* .

foo *bar baz*

``` Over line break: ``` _foo bar_ .

foo bar

``` Inline content allowed: ``` *foo [link](url) `*`* .

foo link *

``` Can't emph an underscore: ``` ___ .

___

``` Unless you escape it: ``` _\__ .

_

``` No empty emph: ``` __ .

__

``` ``` _}b_ .

_}b_

``` ``` _\}b_ .

}b

``` ``` _ab\_c_ .

ab_c

``` ``` *****a***** .

a

``` ``` _[bar_](url) .

[bar](url)

``` ``` \_[bar_](url) .

_bar_

``` Code takes precedence: ``` _`a_`b .

_a_b

``` Autolinks take precedence: ``` _ .

_http://example.com/a_b

```