Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML entities not generated properly in parsedown extensions #909

Open
toodlelew opened this issue Feb 28, 2025 · 1 comment
Open

HTML entities not generated properly in parsedown extensions #909

toodlelew opened this issue Feb 28, 2025 · 1 comment

Comments

@toodlelew
Copy link

toodlelew commented Feb 28, 2025

Environment: Parsedown 1.7.4 in PHP 5.6.40.

Learning how to use Parsedown in order to use it into a PHP-based recipe program to manage recipe instructions.
I've used the example extension ("Add Inline Element") as a basis for a test to handle a markdown extension that will manage measurement unit conversions ("pounds" to "kilograms", "degrees Centigrade" to "degrees Fahrenheit", etc.). The initial test is to recognize a special markdown that indicates temperature in Fahrenheit, and expresses it as "° F".

The extension seems well-formed, properly recognizing the markdown, and (mostly) generating the expected HTML. However,
it does not properly generate the HTML for the ° entity,

Given the input
"Preheat the oven to {F}350{/F} and wait 10 minutes."
I expect the output HTML to be
<p>Preheat the oven to <em>350&deg; F</em> and wait 10 minutes.</p>

However, the invocation of the extension results in
<p>Preheat the oven to <em>350&amp;deg; F</em> and wait 10 minutes.</p>

See attached test php program

testparsedown.txt

It is worth noting that, If I enter the input
"Preheat the oven to 350&deg; F and wait 10 minutes."
directly into parsedown, I get the expected HTML output; parsedown does not convert the input ampersand to an entity

Note: 2024-03-01 edits to clarify expected, actual results.

@toodlelew
Copy link
Author

Expanded test case, and include expected & actual results

testparsedown.txt

exptected_results.txt

actual_results.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant