qiao / coffee-box

A blog engine built upon Node.js, Express, MongoDB and CoffeeScript.
http://66.228.62.171:3000
71 stars 20 forks source link

details about modifing marked lib #3

Closed layerssss closed 11 years ago

layerssss commented 11 years ago

what is the reason?

qiao commented 11 years ago

The original marked library tends to wrap the colorized code snippets into a <p> element, which is not desired.

Before:

```python
print 1

After pygments:

``` html
<div class="highlight">
  <pre>
    <span class="k">print</span> <span class="mi">1</span>
  </pre>
</div>

After marked:

<p>
  <div class="highlight">
    <pre>
      <span class="k">print</span> <span class="mi">1</span>
    </pre>
  </div>
</p>

Notice that the <p> wrapper is superfluous. So I modified marked to suppress this behavior.