Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've installed Sunburst Code Prettify on my new blog. The prettifier uses Highlight.js to prettify code. I've placed the following Python code in a post:

[prettify class="python"]
>>> s=set(['a','b','c'])
>>> ''.join(s)
'acb'
[/prettify]

And got the following highlighting (with some paragraphs for context):

enter image description here

The line breaks are lost, some > were converted to &#8221, and there's an annoying gray background behind the rounded black code frame.

I've tried another Highlight.js plugin, wp-highlight.js:

[code lang="python"]
>>> s=set(['a','b','c'])
>>> ''.join(s)
'acb'
[/code]

And got:

enter image description here

Same gray background, same loss of line breaks.

I've tried switching themes (currently using Mosaic, switched to the standard Twenty-Ten), with no success.

Any ideas what went wrong?

Update - what I've tried:

<pre>:

<pre>
[prettify class="python"]
>>> s=set(['a','b','c'])
>>> ''.join(s)
'acb'
[/prettify]
</pre>

Empty lines:

[prettify class="python"]
>>> s=set(['a','b','c'])

>>> ''.join(s)

'acb'
[/prettify]
share|improve this question

1 Answer 1

I've found that you have to wrap code formatting shortcodes in pre tags.

share|improve this answer
    
I've entered HTML mode and enclosed the [prettify] with <pre> and </pre>, with no luck: matan.name/wordpress –  Adam Matan Nov 27 '12 at 6:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.