Tell Markdown to ignore everything in <code> block?

1.9k views Asked by At

Markdown already ignores everything within a <div> element, and various other block-level elements. However, I need to tell Markdown to ignore everything within <code> blocks as well. Is there a way to tell Markdown to do this?

As an FYI, I am using BlueCloth.

2

There are 2 answers

0
Sim On

The Markdown spec does not specify how <code> blocks should be processed. What exact type of markup are you trying to get the Markdown processors to ignore?

0
Jerry Saravia On

Here is the Markdown Syntax page.

I'm not exactly sure what you want to achieve.

You have something like the following right?

#Heading

<code>
    $my = 'php code here';
</code>

Other text

Do you want your output to be like the one below?

<h1>Heading</h1>

<code>
    $my = 'php code here';
</code>

<p>Other text</p>

For code in markdown you have to indent the code by four spaces so what you should do is the following in your markdown source file.

#Heading

    $my = 'php code here';

Other text

The code is indented four spaces and markdown will surround it with and tags automatically.