Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 799 forks source link

Markdown: unwanted entity encoding occurs inside backticks #2068

Open allendav opened 9 years ago

allendav commented 9 years ago

Entities (like ampersands) inside code fencing backticks get turned into HTML entities if the Visual mode of the editor is used to edit or compose a post (the Text mode leaves them alone), e.g.:

if ( false === $bar && $foo ) return $foobar;

becomes

if ( false === $bar && $foo ) return $foobar;

Just toggling into the visual mode and then back to text mode entity-izes the content. (This also happens inside code tags as well, unfortunately.)

Not sure if the fix lies with Markdown or with the Visual mode of the editor (or both).

jeherve commented 9 years ago

cc @mattwiebe

alanhoff commented 7 years ago

Any news on this issue?

jeherve commented 7 years ago

@alanhoff No news yet. We'll update this issue once we make progress on this.

rmccue commented 6 years ago

Looks like we may be hitting this on the REST API Handbook on WordPress.org (the syncing process internally uses Jetpack Markdown). Other pages appear to be fine however.

kevinwhoffman commented 6 years ago

This bug makes it difficult to use any of the code examples in the REST API Handbook. Every example requires a search and replace to get the correct quotes in place. Do we know what's causing this, yet?

coffee2code commented 6 years ago

The bug as described in the ticket appears to be a separate issue from what was being experienced in the REST API Handbook on w.org. I've fixed the handbook issue, which was reported as #meta3292 (there was too-broadly applied HTML entity handling).

The reported issue of entities getting encoded in the Visual Editor, particularly when toggling between the Text and Visual Editors, is one I've seen before and always chalked it up to TinyMCE and thus avoided use of the Visual Editor when including code. Handbook editors sometimes do input code in the Visual Editor, which often requires someone to manually fix them afterwards.

stale[bot] commented 6 years ago

This issue has been marked as stale. This happened because:

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.