I have a privately hosted blog using WordPress, and I am using the SyntaxHighlighter Evolved plugin for displaying highlighted code snippets nicely.

I use the built-in editor in WordPress for writing my posts, but whenever I paste in code snippets, they lose all the formatting they had (indentation). This makes it very hard to create code snippets and share on my blog.

Am i missing anything? Is there any easy way to paste code snippets while keeping their formatting ?

For example, see what code that was indented correctly shows up in the WP editor (lost all indentation):

enter image description here

  • Use <pre> element. – cybmeta Jan 6 '15 at 18:18
  • @cybmeta how do i use it exactly ? – lysergic-acid Jan 6 '15 at 19:14
  • 1
    Switch to "Text" tab in editor. Although if plugin is involved there might be more to it. – Rarst Jan 6 '15 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.