evilstreak / markdown-js

A Markdown parser for javascript
7.7k stars 863 forks source link

Paragraph tag added to last items in lists #22

Closed jarrodbell closed 11 years ago

jarrodbell commented 13 years ago

The following markdown results in the last items of the lists having a stray <p> tag created:

1. **Mode**

 The following modes are available:
 * 0 = Port Off
 * 232 = RS232 (handshaking determined via the <FlowControl> setting)
 * 485H = Half-duplex RS485
 * 4XXF = Full-duplex RS485 or RS422

1. **BaudRate**

 The following baud rates are available:
 * 100 
 * 300  
 * 600 
 * 1200
 * 2400
 * 4800
 * 9600
 * 14400
 * 19200
 * 38400
 * 57600
 * 115200
 * 128000
 * 256000

1. **DataBits**

 The following data bits are available:
 * 8 = 8 Data Bits

1. **Parity**

 The following parity types are available:
 * N = No Parity
 * O = Odd
 * E = Even
 * S = Space
 * M = Mark

Resulting HTML:

<ol><li><p><strong>Mode</strong></p><p>The following modes are available:</p><ul><li>0 = Port Off</li><li>232 = RS232 (handshaking determined via the &lt;FlowControl&gt; setting)</li><li>485H = Half-duplex RS485</li><li><p>4XXF = Full-duplex RS485 or RS422</p></li></ul></li><li><p><strong>BaudRate</strong></p><p>The following baud rates are available:</p><ul><li>100 </li><li>300   </li><li>600 </li><li>1200</li><li>2400</li><li>4800</li><li>9600</li><li>14400</li><li>19200</li><li>38400</li><li>57600</li><li>115200</li><li>128000</li><li><p>256000</p></li></ul></li><li><p><strong>DataBits</strong></p><p>The following data bits are available:</p><ul><li><p>8 = 8 Data Bits</p></li></ul></li><li><p><strong>Parity</strong></p><p>The following parity types are available:</p><ul><li>N = No Parity</li><li>O = Odd</li><li>E = Even</li><li>S = Space</li><li>M = Mark</li></ul></li></ol>

Notice how each last item of a list is the only one that has the <p>.

evilstreak commented 11 years ago

Whilst this is indeed an oddity, if you're aiming for nested lists this markup isn't the way to do it. Since this issue is two years old (oops, sorry!) I'm closing it.

If you'd still like this looked at, please provide a cutdown test case and provide the resulting markup you'd expect. You should also check what other markdown parsers do.