posts that display and discuss source code

  • Unknown's avatar

    Although it was a little fragile, with the old style editor you use [code language="python"] ...code..... [/code] type structures to include source code in a post.
    Ideally there would be a block type for source code with the new editor, but currently seems to be only the block type which does help but provides no syntax highlighting and is a step backwards.

    Is there some way of having program source code appear in posts currently, or in progress with some place to check when this will be available?

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

  • Unknown's avatar

    Hi there

    Is there some way of having program source code appear in posts currently, or in progress with some place to check when this will be available?

    I found an article that might be of help to you:
    https://en.support.wordpress.com/code/posting-source-code/

    Let me know if this helps with what you are looking to do.

    Best
    Sunil Chauhan

  • Unknown's avatar

    Thank Sunil….that post refers to the old way with the traditional editor that I referred to in my question. This does not work with the new editor(unless there is some trick to get it to work), hence the question. There is the <code> block, but this has no formatting and is not a real substitute.

  • Unknown's avatar

    Hi ogre8o,
    I have tagged this thread as “modlook” which means that a staff member would respond to this as soon as they see it with proper information on
    how to add code blocks in new editor,

    Best
    Sunil Chauhan

  • Hi there,

    Only thing we have is the code block at the moment. Here is more information on how to utilize it, hopefully there is something there that will help:

    Code Block

    However, whenever you need to use source code, you can always switch to the classic editor by clicking on the three dots (next to the cog icon) at the top of the post or page editor and selecting “Switch to Classic Editor”.

    Hope that helps. If there are any future updates, I will be sure to let you know.

    Thanks,

  • Unknown's avatar

    As others have reported, the ‘switch to classic editor’ only does so after losing any previous source code formatting, which means that existing pages can no longer be edited on WordPress.

    Obviously with no current plan with regard to future updates, the only solution is to look at alternatives for hosting software related blogs.
    It is clear I am not the only one with this frustration, with several others posting on the same issue. Some on WordPress, some on other forums suggesting moving from WordPress.

    Funny thing is, the only blog I current pay wordpress.com to host is a software blog, and it has far more traffic than anything else I do. So the blog I am being pushed to move elsewhere is the one with by far the most hits.

  • Hi there,

    If you’re concerned about being able to edit old posts, you can just disable the block editor completely for now, or before you attempt to edit an old post, if you prefer to use the block editor for new posts.

    To disable the block editor, create a new post, click the three dots top-right to open the editor options menu, and select Switch to Classic at the bottom of that menu.

    Or, with the block editor enabled on your site, go to https://kotlinfrompython.wordpress.com/wp-admin/edit.php and edit old posts from there. If you hover over a post title on that screen, you’ll see the option to immediately load the post in the classic editor rather than the block editor, similar to how the Classic Editor plugin works on the self-hosted version.

    The code block does not currently support syntax highlighting, but it is on our list of future enhancements to look at once higher-priority bugs have been addressed. I’ve added your request to the list, as the number of requests we get for a particular feature also impacts on the priority.

  • Unknown's avatar

    I opened a new post, then clicked on the the three dots at upper right. There is no option on the menu that drops down for Switch to Classic — is there some other way to do this? The new editor seems not ready for prime time and I’d like to avoid it until it is.

  • Unknown's avatar

    I found the plugin to go back to Classic Editor and I’ll use that until the new editor problems are solved — is there anywhere to report problems to find out if they will be fixed?

  • Unknown's avatar

    So effectively the new editor is ready for most use cases, but some specific uses, such as sites displaying software source code, could just hold off for now. There is no loss of functionality as long as such sites wait at this time before using the new editor.
    Perhaps having this message clearer will void some angst :)

  • @primepassages – If you want to report bugs you can do so on the official GitHub repository:

    https://github.com/WordPress/gutenberg

    @ogre8o – Exactly. There’s not a loss of functionality to the sites using the old editor and the WordPress community is constantly working on improving the new editor.

  • The topic ‘posts that display and discuss source code’ is closed to new replies.