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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown: MARKDOWN_HASH appearing in output #7535

Closed
rmccue opened this issue Jul 26, 2017 · 0 comments 路 Fixed by #7536
Closed

Markdown: MARKDOWN_HASH appearing in output #7535

rmccue opened this issue Jul 26, 2017 · 0 comments 路 Fixed by #7536
Labels
[Feature] Markdown [Pri] Normal [Type] Bug When a feature is broken and / or not performing as intended
Milestone

Comments

@rmccue
Copy link
Contributor

rmccue commented Jul 26, 2017

馃憢 There appears to be a bug with code blocks inside shortcodes. single_line_code_preserve is called first, replacing code tags with their hash markers. shortcode_preserve is then called, replacing shortcodes with their hash markers. After the Markdown parsing, hashes are then removed.

However, since the code tags were removed first, they're first in the array and are restored first. The shortcodes are then restored afterwards. This means that the code tags are never restored.

The simplest solution here is simply to reverse the hash array before restoration. Happy to PR if that seems sensible.

(Hitting this on WordPress.org while working on meta2968.)

Steps to reproduce the issue

Register a test shortcode. The callback doesn't matter (it just needs to be registered so it gets added to the regex).

add_shortcode( 'test', '__return_empty_string' );

Create a post with the following content:

[test]Text with <code>code</code> in it.[/test]

What I expected

Output of:

[test]Text with <code>code</code> in it.[/test]

What happened instead

Output of:

[test]Text with <code>MARKDOWN_HASHc13367945d5d4c91047b3b50234aa7abMARKDOWN_HASH</code> in it.[/test]
@kraftbj kraftbj added [Pri] Normal [Type] Bug When a feature is broken and / or not performing as intended [Feature] Markdown labels Jul 26, 2017
@oskosk oskosk added this to the 5.7 milestone Dec 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Markdown [Pri] Normal [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants