0

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]

1 Answer 1

2

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

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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