PhileCMS / Phile

A flat file CMS with a swappable parser and template engine.
https://philecms.github.io/
Other
255 stars 48 forks source link

Overriding vendor michelf/php-markdown #346

Open Coachonko opened 2 years ago

Coachonko commented 2 years ago

In my config.php I can only go this far

/**
 * Configure parserMarkdown to work with EnlighterJS
 * https://github.com/michelf/php-markdown
 * https://github.com/EnlighterJS/EnlighterJS
 */
$config['plugins']['phile\\parserMarkdown'] = array(
    'empty_element_suffix' => '',
    'code_class_prefix' => "data-enlighter-language=", 
    // problem 1: the language must be in double quotes
    // problem 2: there should only be <pre></pre> tags without inner <code></code> in code blocks
    'code_attr_on_pre' => true,
);

The behavior is defined by lib/vendor/michelf/php-markdown/Michelf/MarkdownExtra.php. Is there a standard way to override the classes defined in that file to redefine code the block parsing behavior?

At the moment I have solved this problem by editing the parsed HTML on the client, but if the work can be done server-side it would be nice