最終更新日23 Jul 2013 06:56

PHP Markdown Extraでは効かないけど、ただのマークダウンなら効くかんじ。

These restrictions have been lifted in PHP Markdown Extra, and replaced by these less restrictive two:

  • 空白3つ分以上インデントしてはならない。


When the block element is found inside a list,
all its content should be indented with the same amount of space as the list item is indented.
(More indentation won’t do any harm as long as the first opening tag is not indented too much and then become a code block — see first rule.)

Markdown Inside HTML Blocks

Previously in Markdown, you couldn’t wrap Markdown-formatted content inside a <div> element. This is because <div> is a block element and plain Markdown does not format the content of such.

PHP Markdown Extra gives you a way to put Markdown-formatted text inside any block-level tag. You do this by adding a markdown attribute to the tag with the value 1 — which gives markdown="1" — like this:

<div markdown="1">
This is *true* markdown text.

The markdown="1" attribute will be stripped and <div>’s content will be converted from Markdown to HTML. The end result will look like this:

<p>This is <em>true</em> markdown text.</p>

PHP Markdown Extra is smart enough to apply the correct formatting depending on the block element you put the markdown attribute on.
If you apply the markdown attribute to a <p> tag for instance, it will only produce span-level elements inside — it won’t allow lists, blockquotes, code blocks.

But these are some cases where this is ambiguous, like this one for instance:

<td markdown="1">This is *true* markdown text.</td>

A table cell can contain both span and block elements. In cases like this one, PHP Markdown Extra will only apply span-level rules. If you wish to enable block constructs, simply write markdown="block" instead.