size: 2 KiB
| 1 | ``` |
| 2 | *foo bar* |
| 3 | . |
| 4 | <p><strong>foo bar</strong></p> |
| 5 | ``` |
| 6 | |
| 7 | ``` |
| 8 | a* foo bar* |
| 9 | . |
| 10 | <p>a* foo bar*</p> |
| 11 | ``` |
| 12 | |
| 13 | ``` |
| 14 | *foo bar * |
| 15 | . |
| 16 | <p>*foo bar *</p> |
| 17 | ``` |
| 18 | |
| 19 | Unicode spaces don't block emphasis. |
| 20 | |
| 21 | ``` |
| 22 | * a * |
| 23 | . |
| 24 | <p><strong> a </strong></p> |
| 25 | ``` |
| 26 | |
| 27 | Intraword: |
| 28 | |
| 29 | ``` |
| 30 | foo*bar*baz |
| 31 | . |
| 32 | <p>foo<strong>bar</strong>baz</p> |
| 33 | ``` |
| 34 | |
| 35 | ``` |
| 36 | _foo bar_ |
| 37 | . |
| 38 | <p><em>foo bar</em></p> |
| 39 | ``` |
| 40 | |
| 41 | ``` |
| 42 | _ foo bar_ |
| 43 | . |
| 44 | <p>_ foo bar_</p> |
| 45 | ``` |
| 46 | |
| 47 | ``` |
| 48 | _foo bar _ |
| 49 | . |
| 50 | <p>_foo bar _</p> |
| 51 | ``` |
| 52 | |
| 53 | Unicode spaces don't block emphasis. |
| 54 | |
| 55 | ``` |
| 56 | _ a _ |
| 57 | . |
| 58 | <p><em> a </em></p> |
| 59 | ``` |
| 60 | |
| 61 | Intraword: |
| 62 | |
| 63 | ``` |
| 64 | foo_bar_baz |
| 65 | . |
| 66 | <p>foo<em>bar</em>baz</p> |
| 67 | ``` |
| 68 | |
| 69 | ``` |
| 70 | aa_"bb"_cc |
| 71 | . |
| 72 | <p>aa<em>“bb”</em>cc</p> |
| 73 | ``` |
| 74 | |
| 75 | ``` |
| 76 | *foo_ |
| 77 | . |
| 78 | <p>*foo_</p> |
| 79 | ``` |
| 80 | |
| 81 | ``` |
| 82 | _foo* |
| 83 | . |
| 84 | <p>_foo*</p> |
| 85 | ``` |
| 86 | |
| 87 | A line ending counts as whitespace: |
| 88 | |
| 89 | ``` |
| 90 | _foo bar |
| 91 | _ |
| 92 | . |
| 93 | <p>_foo bar |
| 94 | _</p> |
| 95 | ``` |
| 96 | |
| 97 | So does a tab: |
| 98 | |
| 99 | ``` |
| 100 | _ a_ |
| 101 | . |
| 102 | <p>_ a_</p> |
| 103 | ``` |
| 104 | |
| 105 | This one is different from commonmark: |
| 106 | |
| 107 | ``` |
| 108 | _(_foo_)_ |
| 109 | . |
| 110 | <p><em>(</em>foo<em>)</em></p> |
| 111 | ``` |
| 112 | |
| 113 | But you can force the second `_` to be an opener |
| 114 | using the marker `{`. |
| 115 | |
| 116 | ``` |
| 117 | _({_foo_})_ |
| 118 | . |
| 119 | <p><em>(<em>foo</em>)</em></p> |
| 120 | ``` |
| 121 | |
| 122 | Note that an explicitly marked opener can only be closed |
| 123 | by an explicitly marked closer, and a non-marked opener |
| 124 | can only be closed by a non-marked closer: |
| 125 | |
| 126 | ``` |
| 127 | {_ x_ _} _x_} |
| 128 | . |
| 129 | <p><em> x_ </em> _x_}</p> |
| 130 | ``` |
| 131 | |
| 132 | |
| 133 | ``` |
| 134 | _(*foo*)_ |
| 135 | . |
| 136 | <p><em>(<strong>foo</strong>)</em></p> |
| 137 | ``` |
| 138 | |
| 139 | Overlapping scopes (first to close wins): |
| 140 | |
| 141 | ``` |
| 142 | _foo *bar_ baz* |
| 143 | . |
| 144 | <p><em>foo *bar</em> baz*</p> |
| 145 | ``` |
| 146 | |
| 147 | Over line break: |
| 148 | |
| 149 | ``` |
| 150 | _foo |
| 151 | bar_ |
| 152 | . |
| 153 | <p><em>foo |
| 154 | bar</em></p> |
| 155 | ``` |
| 156 | |
| 157 | Inline content allowed: |
| 158 | |
| 159 | ``` |
| 160 | *foo [link](url) `*`* |
| 161 | . |
| 162 | <p><strong>foo <a href="url">link</a> <code>*</code></strong></p> |
| 163 | ``` |
| 164 | |
| 165 | Can't emph an underscore: |
| 166 | |
| 167 | ``` |
| 168 | ___ |
| 169 | . |
| 170 | <p>___</p> |
| 171 | ``` |
| 172 | |
| 173 | Unless you escape it: |
| 174 | |
| 175 | ``` |
| 176 | _\__ |
| 177 | . |
| 178 | <p><em>_</em></p> |
| 179 | ``` |
| 180 | |
| 181 | No empty emph: |
| 182 | |
| 183 | ``` |
| 184 | __ |
| 185 | . |
| 186 | <p>__</p> |
| 187 | ``` |
| 188 | |
| 189 | ``` |
| 190 | _}b_ |
| 191 | . |
| 192 | <p>_}b_</p> |
| 193 | ``` |
| 194 | |
| 195 | ``` |
| 196 | _\}b_ |
| 197 | . |
| 198 | <p><em>}b</em></p> |
| 199 | ``` |
| 200 | |
| 201 | ``` |
| 202 | _ab\_c_ |
| 203 | . |
| 204 | <p><em>ab_c</em></p> |
| 205 | ``` |
| 206 | |
| 207 | ``` |
| 208 | *****a***** |
| 209 | . |
| 210 | <p><strong><strong><strong><strong><strong>a</strong></strong></strong></strong></strong></p> |
| 211 | ``` |
| 212 | |
| 213 | ``` |
| 214 | _[bar_](url) |
| 215 | . |
| 216 | <p><em>[bar</em>](url)</p> |
| 217 | ``` |
| 218 | |
| 219 | ``` |
| 220 | \_[bar_](url) |
| 221 | . |
| 222 | <p>_<a href="url">bar_</a></p> |
| 223 | ``` |
| 224 | |
| 225 | Code takes precedence: |
| 226 | |
| 227 | ``` |
| 228 | _`a_`b |
| 229 | . |
| 230 | <p>_<code>a_</code>b</p> |
| 231 | ``` |
| 232 | |
| 233 | Autolinks take precedence: |
| 234 | |
| 235 | ``` |
| 236 | _<http://example.com/a_b> |
| 237 | . |
| 238 | <p>_<a href="http://example.com/a_b">http://example.com/a_b</a></p> |
| 239 | ``` |