Source code formatting

  • Unknown's avatar

    Hi,

    I would like to format the source code I append to the blog with a proper background. I have personal account.
    How can I do that?

    Regards,
    George

    The blog I need help with is: (visible only to logged in users)

  • Hi there,

    What exactly do you mean by source code you append?

    Certain types of code are automatically stripped out if you try to add it on WordPress.com, so if you want to publish code in a post or page, you need to use the code-shortcode. That shortcode includes a syntax highlighter that supports several languages, but it does not have the option to set a specific background for the code section.

    https://en.support.wordpress.com/code/posting-source-code/

    You might be able to do something by wrapping your code in div-tags and using the style-attribute to add a background to that, or else you might be able to add styling to the syntax highlighter using custom CSS, but for the latter you’d need to be on the Premium Plan.

  • The topic ‘Source code formatting’ is closed to new replies.