怎么修? Wordpress wp-markdown插件损坏了语法-突出显示的插件帖子? [英] How to fix? Wordpress wp-markdown plugin corrupted syntax-highlighter-evolved plugin posts?

查看:119
本文介绍了怎么修? Wordpress wp-markdown插件损坏了语法-突出显示的插件帖子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去几个月来,我一直在Wordpress上用语法-highlighter-evolved 插件.一切都很好.例如C ++代码在帖子中正确显示.例如以下语法将在wordpress中很好地显示C ++代码.

I have been documenting some C++ codes (or can be any codes) over the past few months on wordpress, with the Syntax-highlighter-evolved plugin. Everything had worked fine. e.g. the C++ codes displayed correctly in post. e.g. the following syntax would display C++ codes nicely in wordpress.

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

最近,我开始探索在wordpress中使用mark-down,并开始使用

Recently, I have started exploring using mark-down in wordpress and started writing mark-down in new posts with the wp-markdown plugin. (For the benefits of simplicity and ease of migration / sharing / maintenance in long term).

...然后……我意识到我所有的较早的帖子(用Syntax-highligher-evolved语法包装的代码)都已损坏!

... And then ... I realized all of my older posts (with codes wraped in the Syntax-highligher-evolved syntax) have all got corrupted!

例如,字符(如< >等)已转换为HTML实体(如&lt; &gt;等).此外,我还看到将HTML标签的LOAD插入到C ++代码中.

For example, characters (like < > etc), got converted into HTML entities (like &lt; &gt; etc). In addition, I also see LOADS of HTML tags being inserted into the C++ codes.

此处在我的wordpress网站上的示例帖子(向下滚动至,您将看到一些代码块.).它包含一些假定的C ++代码,现在看起来好像C ++代码一样.

See here for a sample post on my wordpress site (scroll down to and you will see some code blocks.). It contains some supposingly C++ codes which now looks nothing like C++ codes.

在发现此错误之后,我尝试玩弄激活和停用插件以查看是否可以返回工作状态(即代码显示为C ++代码,而不是C ++/HTML混合代码).到目前为止没有运气.

Following discovering this error I have attempted playing around with activating and deactiving the plugins to see if I could get back to the working state (i.e. codes being displayed as C++ codes, instead of hybrid C++/HTML code). No luck so far.

(目前,我同时激活了语法高亮显示和wp-markdown插件).

(Currently I have both syntax-highlighter-evoled and wp-markdown plugins activated).

任何人之前都遇到过类似的问题,您如何解决此问题?

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

将非常感谢您提供的所有帮助!

Would be very grateful for all the help!

作为一种解决方法,我已(1)禁用了wp-markdown插件. (2)启用了语法高亮演变的语法. (3)激活了Jetpack markdown插件.以下手动解决方法步骤帮助我纠正了1个(约100个)帖子.

As a workaround I have (1) disabled the wp-markdown plugin. (2) Kept the syntax-highlighter-evolved activated. (3) Activated the Jetpack markdown plugin. The manual workaround steps below helped me correct 1 (out of about 100) posts.

  • Jetpack markdown插件似乎可以更好地补充语法-highlighter-evolved插件. (根据我到目前为止的观察.)

  • It looks like the Jetpack markdown plugin complement better with the syntax-highlighter-evolved plugin. (based on my observations so far.)

作为一个实验,我通过(1)关闭wordpress可视编辑器手动修改了一个旧帖子. (2)编辑了旧帖子.这是 vs old .

As an experiment, I have modified manually an old post by (1) turning the wordpress visual editor off. (2) edited that old post. Here are the new vs old.

当我开始编辑旧帖子时,我注意到整个帖子在编辑器中自动转换为mark-down格式(很好).好消息是,意外的HTML标记现在已经消失了(我想是因为我使用的是最小的wordpress编辑器,而不是视觉编辑器).因此,至少我可以将整个markdown式帖子恢复/复制到文本编辑器中(如桌面上的崇高文字).

when I started editing the old post, I noticed that the entire post was converted automatically to mark-down format in the editor (which is good). The good news was, the unexpected HTML tag now had gone away (I presume because I was using the bare minimum wordpress editor, instead of the visual editor). So at least I could recover / copy the entire chunk of markdown-like post to a text editor (like sublime text on my desktop).

但是,这种转换并不完美-我注意到了一些副产品.例如...

This conversion was not perfect however - I noticed some by-products. such as...

许多回车符(即新行)消失了-导致多行合并"为一行.我必须手动发现这些行,然后将它们一一重新格式化. (很痛苦!)

lots of carriage return (i.e. new line) disappeared - causing multiple lines got "merged" into one line. I had to manually spot for these lines and re-format them one-by-one. (a pain!)

我还注意到#include之类的东西显示为# include(中间增加了空格).因此,我不得不手动更正那些.同样,对于包含#的其他某些实体.

I noticed also things like #include appeared as # include (added space in the middle). So I had to manually correct those. Likewise for some other entities containing #.

要手动编辑旧的(现在是准降价的)帖子,我将所有旧的语法高亮显示打开标签[code language="cpp"]删除了三个反引号,并加上了代码扩​​展名(``` .cpp).然后将标签[/code]关闭到三个反勾号(```).请参阅 Jetpack Markdown文档

To manually edit the old (now semi-markdown) post, I removed all the legacy syntax-highlighter open tag [code language="cpp"] to three back-tick plus the code extension (```.cpp). And the close tag [/code] to three back-tick (```). See the Jetpack Markdown Doc and Markdown Extra Doc for more info.

使用新的Jetpack markdown语法更新帖子后,语法高亮演变的语法似乎了解"这些新标记,并自动对其应用c ++颜色编码. (如果我使用三个不带代码扩展名的反引号,则语法突出显示功能仍然可以将代码包装成一个块,只是没有颜色).

Once updated post with the new Jetpack markdown syntax, the syntax-highlighter-evolved seemed to "know" about these new tag and automatically apply c++ color coding to it. (if I use three back-tick without the code extension, the syntax-highlighter still work to wrap the code into a block, just without the color).

网络净额.好消息是,我找到了一种解决方法,可以使我手动地逐一"升级帖子(以及一种恢复旧帖子的方法-即通过禁用wordpress可视编辑器,不再在代码中出现意外的HTML标签) ).缺点:这将是一个漫长的过程,因为我将不得不手动发现丢失的回车符并将它们重新添加到代码块中.像这样更新100个帖子需要花费一些时间.

Net net. The good news is that I have found a workaround which will enable me to "upgrade" the post one-by-one, manually (and a way to recover old posts - i.e. no more unexpected HTML tags in code by disabling the wordpress visual editor). Downside: this will be a lengthy process as I will have to manually spot for the missing carriage-return and re-add them to the code block. Updating 100 posts like this will take... some time.

  • 意识到WP插件实际上破坏了原始博客文章文件.因此,作为快速解决方案,我使用编辑器手动编辑了100个帖子,并用更正的版本替换了所有损坏的代码.花了我3天的时间去做,但至少要纠正.

  • Realized that the WP-plugin actually corrupt the original blog post files. So as a quick fix I manually edited the 100 posts using the editor, and replaced all the damaged code with the corrected version. Took me 3 days solid to do but at least corrected.

我注意到Jetpack Markdown插件和/或Syntax Highliter Evolved没有完善.例如甚至用开始和结束代码标签包装代码,仍然存在一些错误-例如反斜杠被剥除,小于/大于符号未按预期显示等.

I noticed that the Jetpack Markdown Plugin and/or the Syntax Highliter Evolved are not perfected. e.g. even wraping a code with the opening and closing code tags, some bugs remained - such as backslashes got stripped, the less-than / greater than signs not displayed as expected, etc.

因此,为了创建新帖子,我尝试了将(Github)Gist与oEmbed Gist插件结合使用(如下面的@OllieJones所建议).到目前为止效果很好(Gist似乎显示了预期的代码.时间会证明一切).我有一种前进的感觉,我可以使用Gist将我的所有博客文章存储在markdown文件中,而只需使用Wordpress来显示"这些markdown文件. (我想知道是否也可以使用Gist来存储图像文件?还是我需要坚持使用Wordpress来存储图像文件?).

So I for creating new posts, I have tried out the (Github) Gist in conjunction with oEmbed Gist plugins (as suggested by @OllieJones below). Works beautifully so far (Gist seem to display codes as expected. Time will tell). I have this feeling that going forward I can use Gist to store all of my blog posts in markdown files, and simply use Wordpress to "display" these markdown files. (I wonder if Gist can be used to store the image files as well? Or I need to stick to Wordpress to store the image files?).

以下是一些使用Gist方法的示例新博客帖子. example1 example2 .

Here are some sample new blog posts using the Gist method. example1, example2.

推荐答案

doggone markdown插件在加载帖子进行编辑时将帖子从HTML转换为markdown,并在更新时将其翻译回.我有同样的问题,代码被破坏了.这是一个很大的痛苦. (我用备份修复了它.)

The doggone markdown plugin translates posts from HTML to markdown when it loads them for editing, and translates them back when you Update them. I've had the same problem with code getting trashed. This is a big pain. (I fixed it with a backup.)

我的解决方案是在 http://gist.github.com/上使用要点-显示我的代码. oEmbed Gist插件使它很好地工作.

My solution is to use gists -- on http://gist.github.com/ -- to display my code. The oEmbed Gist plugin makes that work very well.

这篇关于怎么修? Wordpress wp-markdown插件损坏了语法-突出显示的插件帖子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆