Skip to content

Commit

Permalink
Merge pull request #329 from th-h/lib
Browse files Browse the repository at this point in the history
Treat <details> and <summary> as block level.
  • Loading branch information
michelf authored Apr 22, 2020
2 parents 71f6fb8 + 398690d commit 6975244
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Michelf/Markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ protected function hashHTMLBlocks($text) {
$block_tags_b_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|'.
'script|noscript|style|form|fieldset|iframe|math|svg|'.
'article|section|nav|aside|hgroup|header|footer|'.
'figure';
'figure|details|summary';

// Regular expression for the content of a block tag.
$nested_tags_level = 4;
Expand Down
2 changes: 1 addition & 1 deletion Michelf/MarkdownExtra.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ protected function _stripLinkDefinitions_callback($matches) {
* Tags that are always treated as block tags
* @var string
*/
protected $block_tags_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|form|fieldset|iframe|hr|legend|article|section|nav|aside|hgroup|header|footer|figcaption|figure';
protected $block_tags_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|form|fieldset|iframe|hr|legend|article|section|nav|aside|hgroup|header|footer|figcaption|figure|details|summary';

/**
* Tags treated as block tags only if the opening tag is alone on its line
Expand Down
7 changes: 7 additions & 0 deletions test/resources/php-markdown.mdtest/Inline HTML (Simple).html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
<hr class="foo"
id="bar" >

<p>Details and Summary:</p>

<details>
<summary>Some details</summary>
<p>More info about the details.</p>
</details>

<p>Regression:</p>

<pre>
Expand Down
7 changes: 7 additions & 0 deletions test/resources/php-markdown.mdtest/Inline HTML (Simple).text
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ Hr's:
<hr class="foo"
id="bar" >

Details and Summary:

<details>
<summary>Some details</summary>
<p>More info about the details.</p>
</details>

Regression:

<pre>
Expand Down

0 comments on commit 6975244

Please sign in to comment.