taufik-nurrohman / parsedown-extra-plugin

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

Update ParsedownExtraPlugin.php #22

Closed davehold closed 3 years ago

davehold commented 3 years ago

Fixed an issue where this caused the prefix "language" to be added twice (with parsedown 1.8 beta 7)

taufik-nurrohman commented 3 years ago

The option was added to automatically append language- prefix to code block class name without dot prefix. The correct fix would be to check whether a class name already prefixed with language- from the initial state. If that’s the case, do not add prefix.

taufik-nurrohman commented 3 years ago

If that’s your preference, (to add language- prefix manually from the markdown source), you can create the same effect without modifying the core this way:

$Parsedown = new ParsedownExtraPlugin;
$Parsedown->blockCodeClassFormat = '%s';

echo $Parsedown->text(file_get_contents('./example.md'));