This plugin is this close to doing exactly what I need, but I’m having a strange problem. I have fenced code blocks in my post, like:
~~~~
!#cpp
int main()
{
/*...*/
}
~~~~
This shows up in code font, but is not syntax highlighted. If, somewhere else on the page, I have another code block of this form:
[code lang="cpp"]
int foo() { return 0; }
[/code]
… then that shows up highlighted, and so does the other block! How crazy is that?
I’d be fine with this workaround if it weren’t for one thing. When I use the [code]...[/code] form, WP-Markdown makes a hash of that code’s formatting. So my choices are to have no code highlighted, or else have one block that is mis-formatted. Gah. Any guidance is appreciated.
I’m using WP-Markdown 1.2, SyntaxHighlighter Evolved 3.1.7, and wp-markdown-syntaxhighlighter 0.4.
https://www.ads-software.com/extend/plugins/wp-markdown-syntaxhighlighter/
]]>An get error to activate plugin
El plugin no ha podido activarse porque ha provocado un error fatal.
Parse error: syntax error, unexpected T_FUNCTION in /home/u54723/domains/erufenix.com.mx/public_html/wp-content/plugins/wp-markdown-syntaxhighlighter/wp-markdown-syntaxhighlighter.php on line 49
line 49 in wp-markdown-syntaxhighlighter.php
function wmsh_filter_markdown( $text ) {
$return = preg_replace_callback(
'<pre><code>#!!([^\n]+)\n(.*?)</code></pre>|s',
function( $m ) {
return wmsh_add_parameters($m[2], $m[1]);
},
$text
);
https://www.ads-software.com/extend/plugins/wp-markdown-syntaxhighlighter/
]]>When I test with the “canonical” example, the code isn’t highlighted in the preview.
With the “canonical” example, I of course mean this:
#!ruby
class Foo < Bar
def hello
puts "Hello World!"
end
end
The code is highlighted in the editor preview pane, but then it’s highlighted even without the #!ruby
line. If I preview the page then it is not highlighted. Also, the “shebang” line is shown in the preview pane, but not in the preview page.
I have installed the SyntaxHighlighter Evolved (version 3.1.7), WP-Markdown (version 1.2) and WP-Markdown-SyntaxHighlighter (version 0.4) plugins, in that order.
Is there something wrong on my side or is it a bug somewhere?
]]>