Jetpack: Markdown: unwanted entity encoding occurs inside backticks

Created on 1 May 2015  Â·  7Comments  Â·  Source: Automattic/jetpack

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).

Markdown [Pri] Normal [Status] Stale [Type] Bug

Most helpful comment

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.

All 7 comments

cc @mattwiebe

Any news on this issue?

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

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.

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?

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.

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

  • It has been inactive in the past 6 months.
  • It hasn’t been labeled `[Pri] Blocker`, `[Pri] High`.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aheckler picture aheckler  Â·  3Comments

kevinlisota picture kevinlisota  Â·  3Comments

beaulebens picture beaulebens  Â·  3Comments

jeherve picture jeherve  Â·  3Comments

beaulebens picture beaulebens  Â·  3Comments