Compare commits

..

No commits in common. "master" and "0.0.1" have entirely different histories.

2 changed files with 5 additions and 7 deletions

View File

@ -10,7 +10,7 @@
class ParsedownCheckbox extends ParsedownExtra class ParsedownCheckbox extends ParsedownExtra
{ {
const VERSION = '0.0.2'; const VERSION = '0.0.1';
protected function blockListComplete($block) protected function blockListComplete($block)
{ {
@ -41,11 +41,9 @@ class ParsedownCheckbox extends ParsedownExtra
if ('[ ] ' === $begin_line) { if ('[ ] ' === $begin_line) {
$block['element']['text'][$iterator_element]['text'][$iterator_text] = '<input type="checkbox" disabled /> '. $block['element']['text'][$iterator_element]['text'][$iterator_text] = '<input type="checkbox" disabled /> '.
substr(trim($block['element']['text'][$iterator_element]['text'][$iterator_text]), 4); substr(trim($block['element']['text'][$iterator_element]['text'][$iterator_text]), 4);
$block['element']['text'][$iterator_element]['attributes'] = ['class' => 'parsedown-task-list parsedown-task-list-open'];
} elseif ('[x] ' === $begin_line) { } elseif ('[x] ' === $begin_line) {
$block['element']['text'][$iterator_element]['text'][$iterator_text] = '<input type="checkbox" checked disabled /> '. $block['element']['text'][$iterator_element]['text'][$iterator_text] = '<input type="checkbox" checked disabled /> '.
substr(trim($block['element']['text'][$iterator_element]['text'][$iterator_text]), 4); substr(trim($block['element']['text'][$iterator_element]['text'][$iterator_text]), 4);
$block['element']['text'][$iterator_element]['attributes'] = ['class' => 'parsedown-task-list parsedown-task-list-close'];
} }
} }
} }

View File

@ -16,12 +16,12 @@ EOF;
$html = <<<EOF $html = <<<EOF
<ul> <ul>
<li class="parsedown-task-list parsedown-task-list-open"><input type="checkbox" disabled /> test 1</li> <li><input type="checkbox" disabled /> test 1</li>
<li>[] test 2</li> <li>[] test 2</li>
<li class="parsedown-task-list parsedown-task-list-close"><input type="checkbox" checked disabled /> test 3 <li><input type="checkbox" checked disabled /> test 3
<ul> <ul>
<li class="parsedown-task-list parsedown-task-list-open"><input type="checkbox" disabled /> test 4</li> <li><input type="checkbox" disabled /> test 4</li>
<li class="parsedown-task-list parsedown-task-list-close"><input type="checkbox" checked disabled /> test 5</li> <li><input type="checkbox" checked disabled /> test 5</li>
</ul></li> </ul></li>
<li><a href="https://markdown.org">test</a> 6</li> <li><a href="https://markdown.org">test</a> 6</li>
<li><a href="https://markdown.org">x</a> test 7</li> <li><a href="https://markdown.org">x</a> test 7</li>