erusev / parsedown

Better Markdown Parser in PHP
https://parsedown.org
MIT License
14.69k stars 1.12k forks source link

Sub/Superscripts Improvement #724

Open MarkMessa opened 4 years ago

MarkMessa commented 4 years ago

Currently I'm using a modified version of Parsedown that supports subscripts and superscripts (ex: H\~2\~O, 19^th^):

Original Parsedown vs Sub/Superscript Version

Although it is working fine so far, it is somewhat unpleasant to modify the source code directly.
It would be much better if all these modifications were in a different file such that Parsedown could be loaded like:

require_once 'Parsedown.php'; // Original version of Parsedown source code
require_once 'Parsedown_sub_superscript.php'; // Extension with support for sub/superscript

$Parsedown = new SubSuperscriptParsedown();

echo $Parsedown->text('The H~2~O formula for water was found in the 19^th^ century.');

Output:
<p>The H<sub>2</sub>O formula for water was found in the 19<sup>th</sup> century.</p>

Therefore, is it possible to push all these modifications into a different file?

flame05 commented 1 year ago

@MarkMessa Just wanted to say thanks for this improvement :D