My Code Markup WordPress plugin has been updated to version 1.1. Code Markup makes it easy to include program code samples in your posts. You can even include HTML markup in the code sample; Code Markup magically knows which characters should be displayed as code and which should be rendered as HTML. This new version has a few nice new features:
Valid HTML
Code Markup no longer forces you to write invalid (X)HTML — it now strips the “allow†and “lang†attributes when displaying posts. The attributes are still there when you edit the posts, of course.
Explicitly specify allowed tags
You can now explicitly specify a set of allowed HTML tags in the “allow†attribute. For example, you can explicitly say that you want a
and span
tags to be allowed as normal HTML, but all other tags should be displayed exactly as you typed them.
HTML Comments
HTML comments are now allowed by default.
Download
For details and download, see the main Code Markup page.
Great plugin! Thanks for putting it together. I may have come across a bug, however. C++ code such as:
#include <iostream>
int main()
{
std::cout << “Hello, world!\n”;
return 0;
}
comes out with the slash missing in the new-line character within the string literal. To work around this I’m having to put double \\. Single slashes seem to work outside of <pre><code> just fine.
Edd
Thanks for that, Edd. Code Markup contains a workaround for a WordPress bug to do with backslashes — maybe the workaround doesn’t work in all cases. I will investigate.
I’m currently working around the problem by doing an str_replace of each single slash with a double slash before the call to htmlspecialchars on line 117-ish.
It’s probably not the ‘correct’ thing to do, but it’s a temporary fix for anyone else with the same problem.
Edd
thsnks
turkiye en büyük sohbet odasi
thanks