How to fix? Wordpress wp-markdown plugin damaged syntax messages-highlighter-evolved plugin?

I have documented some C ++ codes (or may be any codes) over the past few months in wordpress, with a syntax-shortcut-developed plugin. Everything worked perfectly. for example, C ++ codes display correctly in the message. for example, the following syntax will display C ++ codes in wordpress well.

[code language="cpp"] c++ codes goes here... [/code] 

Recently, I began to study the use of tags in Wordpress and began to write markup in new posts using the wp-markdown plugin , (For the benefits of simplicity and ease of migration / sharing / maintenance in the long run).

... And then ... I realized that all my older posts (with codes cracked in Syntax-highligher-developed syntax) are all messed up!

For example, characters (e.g. < > , etc.) have been converted to HTML objects (e.g. &lt; &gt; etc.). In addition, I also see that LOADS HTML tags are inserted into C ++ codes.

See here for a sample post on my Wordpress website (scroll down and you will see some blocks of code). It contains some presumably C ++ codes, which now do not look like C ++ codes.

After detecting this error, I tried playing with the activation and deactivation of the plugins to find out if I can return to working condition (i.e. codes are displayed as C ++ codes, not hybrid C ++ / HTML code). So far no luck.

(Currently, syntax and highlighting modules are activated, as well as wp-markdown).

Has anyone encountered similar problems before and how did you resolve this?

I would be very grateful for all the help!

UPDATES (Monday, March 2, 2015):

As a workaround, I (1) disabled the wp-markdown plugin. (2) Holds the activated syntax marker. (3) Activated the Jetpack utilities plugin. The workarounds below helped me fix 1 (out of about 100) messages.

  • The markdown Jetpack plugin seems to complement the plugin with highlight syntax better. (according to my observations so far.)

  • As an experiment, I manually changed the old entry: (1) turned off the visual editor Wordpress. (2) edited this old post. Here is the new vs old .

  • when I started editing the old message, I noticed that all mail was automatically converted to the markup format in the editor (which is good). The good news was that the unexpected HTML tag was now gone (I suppose because I used a minimal Wordpress editor instead of a visual editor). Therefore, at least I could restore / copy the entire fragment of the note, similar to the mark, to a text editor (for example, sublime text on my desktop).

  • This conversion was not perfect, but I noticed some by-products. such as...

  • many carriage returns (i.e. a new line) disappeared, resulting in multiple lines being merged into one line. I had to manually identify these lines and reformat them one by one. (pain!)

  • I noticed that things like #include appeared as # include (added space in the middle). Therefore, I had to manually fix them. Similarly for some other objects containing # .

  • To manually edit the old (now semi-reporting) record, I deleted the entire old tag [code language="cpp"] the shortcut syntax [code language="cpp"] to three back ticks plus the code extension ( ``` .cpp). And the close [/code] tag on three back-tick ( ``` ). See Jetpack Markdown Doc and Markdown Extra Doc for more information.

  • After updating the message with the new Jetpack markup syntax, the syntax-highlighter-evolved seemed to β€œknow” about these new tags and automatically applied C ++ color coding to it. (if I use three back-ticks without a code extension, the marker syntax still works to wrap the code in a block, just without color).

  • Clean network. The good news is that I have found a workaround that will allow me to β€œupdate” the message one by one manually (and a way to recover old messages, i.e. More unexpected HTML tags in the code, by disabling the WordPress visual editor). Downside: this will be a lengthy process, as I will have to manually determine the missing carriage return and re-add them to the code block. Updating 100 posts like this will take some time.

Update (March 7, 2015)

  • I realized that the WP plugin actually damages the source blog post files. As a quick fix, I manually edited 100 messages using the editor and replaced all the damaged code with the corrected version. Took me for 3 days to do, but at least fixed it.

  • I noticed that the Jetpack Markdown plugin and / or syntactic Highliter Evolved have not been enhanced. for example, even crossing the code with the tags of opening and closing the code, some errors remained - such as backslashes, separated, less or more than characters that do not appear as expected, etc.

  • So, to create new posts, I tried the Gistub Gist in conjunction with the oEmbed Gist plugins (as suggested by @OllieJones below). It still works beautifully (Gist seems to display codes as expected. Time will tell). I have the feeling that in the future I can use Gist to store all my blog posts in markup files and just use Wordpress to "display" these markup files. (I wonder if Gist can be used to store image files? Or do I need to stick with Wordpress to store image files?).

  • Here are some examples of new blog posts using the Gist method. example1 , example2 .

+3
markdown wordpress syntaxhighlighter
source share
3 answers

The markdown plugin doggone translates messages from HTML into markdowns when it downloads them for editing, and translates them back when you update them. I had the same issue with code crashing. This is a big pain. (I fixed it with a backup.)

My solution is to use gists - on http://gist.github.com/ - to display my code. oEmbed Gist plugin does the job very well.

+3
source share

Take a look at Highlight.js, it is very good and supports many languages:

Hightlight.js - quick launch demo

+1
source share

Sorry I'm late.

You can edit the SyntaxHighlighter plugin.

  • open the syntax Highlighter plugin, edit it
  • Wordpress will open syntaxhighlighter.php file
  • search and record all the lines "htmlspecialchars" and "htmlspecialchars_decode" (maybe you need to backup)
  • save him

I used this fixed success.

My englist is bad, but I tried my best, hope it can help you.

0
source share

All Articles