Change / modify <code> class

Hey there,
I see how my question might be related to this post, however …

So far I tried extending Parsedown like mentioned here with:

class Extension extends Parsedown
{

  #
  # Fenced Code

  protected function blockFencedCode($Line)
  {
    if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches))
    {
      $Element = array(
        'name' => 'code',
        'text' => '',
      );
      if (isset($matches[1]))
      {
        $class = 'language-'.$matches[1].' hljs';
        $Element['attributes'] = array(
          'class' => $class,
        );
      }
      $Block = array(
        'char' => $Line['text'][0],
        'element' => array(
          'name' => 'pre',
          'handler' => 'element',
          'text' => $Element,
        ),
      );
      return $Block;
    }
  }
}

after enabling parsedown extra I tried using this parsedown extra plugin to achieve what I want: besides the language-[name-of-language] class I want to add anothe one, quick and painless.

Any ideas are appreciated!

Cheers.

What is this other thing you want to achieve? You don’t need a plugin to add the language class, that works out of the box.

He wants Parsedown to take this (~ = `):

~~~someLanguage
<some-code>
  hello
</some-code>
~~~

and output this (by default):

<pre>
<code class="language-someLanguage custom-class">
  hello
</code>
</pre>

And question was, how to achieve this easily …

So far he tried beforementioned Parsedown Extra plugin, which has this functionality:

// Custom Code Class Format
$parser->code_class = 'language-%s';

// which would be modified like:
$parser->code_class = 'language-%s custom-class';

What I was trying to say was: If you do this in in Kirby

/```php
<?php // some code ?>
/```

(slashes just to escape the code)

the result will be

<pre><code class="language-php"><?php // some code ?></code></pre>

without using a plugin.

I think you should be able to use a Kirbytext filter to modify this further.