title: How to prevent Markdown from wrapping the generated HTML in a <p> element?
body: <p><strong>Update:</strong> The bounty is for a solution using the “marked” library.</p>
  
  <hr>
  
  <p>This Markdown code:</p>
  
  <pre><code>*foo*
  </code></pre>
  
  <p>will produce this HTML code:</p>
  
  <pre><code>&lt;p&gt;&lt;em&gt;foo&lt;/em&gt;&lt;/p&gt;
  </code></pre>
  
  <p><strong>Live demo:</strong> <a href="https://jsbin.com/luganot/edit?js,console" rel="nofollow noreferrer">https://jsbin.com/luganot/edit?js,console</a></p>
  
  <p>However, I'm already injecting the generated HTML code into an inline context, like so:</p>
  
  <pre><code>&lt;p&gt; text [inject generated HTML here] text &lt;/p&gt;
  </code></pre>
  
  <p>so I don't want the <code>&lt;p&gt;</code> element to wrap around the generated HTML code. I just want the <code>*</code> delimiters to be converted to an <code>&lt;em&gt;</code>, element, and so on.</p>
  
  <p>Is there a way to tell the Markdown converter to not produce the <code>&lt;p&gt;</code> wrapper? Currently, I'm doing a <code>.slice(3,-4)</code> on the generated HTML string, which does remove the <code>&lt;p&gt;</code>, and <code>&lt;/p&gt;</code> tags, but this is obviously not a solution I'd like to keep for the long-term.</p>