taufik-nurrohman / parsedown-extra-plugin

Configurable Markdown to HTML converter with Parsedown Extra.
MIT License
60 stars 13 forks source link

Add Block Syntax? #19

Closed taufik-nurrohman closed 4 years ago

taufik-nurrohman commented 4 years ago

This kind of syntax started to be a common:

::: info
Here are some info message.
:::

Result would be something like this:

<div class="info">
  <p>Here are some info message.</p>
</div>

But I wonder if it would be necessary since the syntax could be made easily using the existing block quote syntax. By hooking to the blockQuoteAttributes or blockQuoteText method, we could set specific title and classes to the block quote element (and even replace the <blockquote> tag to something else):

> **Info:** Here are some info message.
$Parsedown->blockQuoteAttributes = function($Text, $Attributes, &$Element) {
    if (0 === strpos($Text, '**Info:** ')) {
        $Element['name'] = 'div';
        return ['class' => 'info'];
    }
    return [];
};
taufik-nurrohman commented 4 years ago

I must re-clarify my initial goal in making this extension, which is, to add the configuration features above the ParsedownExtra extension, not more than that. Therefore, I will most likely not approve any new syntax request in the future. Including this feature.