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

Problem with HTML entiy parsing #206

Closed
jkphl opened this issue Nov 16, 2015 · 2 comments
Closed

Problem with HTML entiy parsing #206

jkphl opened this issue Nov 16, 2015 · 2 comments

Comments

@jkphl
Copy link

jkphl commented Nov 16, 2015

The parser seems to have a problem with HTML entity detection / handling. Example:

$environment = \League\CommonMark\Environment::createCommonMarkEnvironment();
$parser = new \League\CommonMark\DocParser($environment);
$renderer = new \League\CommonMark\HtmlRenderer($environment);

echo $renderer->renderBlock($parser->parse(
    "If you want to write about 'AT&T', you need to write '`AT&T`'."
));

results in

<p>If you want to write about 'AT&amp;T`'.</p>

Half of the sentence is swallowed, probably due to the parser interpreting the first &T as the start of an (invalid) HTML entity I guess‽

@colinodell
Copy link
Member

This is likely a duplicate of #192. Basically the EntityParser would "eat" everything between the first & and the last HTML entity.

Version 0.12 contains a fix for this issue, so please upgrade to this version. (This Babelmark 2 test shows that 0.12 behaves as expected given your input).

@jkphl
Copy link
Author

jkphl commented Nov 17, 2015

You're right, updating to 0.12 fixed it — I somehow missed that latest release. Thank you! :)

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

2 participants