CLI Code indentation not working

  • Unknown's avatar

    So I’ve recently had to change a sites theme. A result of which is that some of my pages, which display CLI code, have lost their indentation.

    For example the code on: https://netquirks.co.uk/ios-vs-xr/pim-sm-static/

    Should have several indentation in it (rather than every line starting on the hard left).

    If I edit the page and “covert to blocks” it appears to remove the newline characters entirely (presenting the whole block as one line). So I edit it as html and can see it is trying to make a table.

    (I’m going to try and paste this output within html tags so you can see what I see… if it does not work… don’t worry, the irony will not be lost on me…)

    <figure class="wp-block-table"><table><tbody><tr><td>
    <pre style="text-align:left;">ip multicast-routing
    !
    interface FastEthernet0/0
     description link PC LAN
     ip address 10.11.2.25 255.255.255.0
     ip pim sparse-mode
     ip cgmp
     ip ospf 1 area 0
     speed 100
     full-duplex 
    !
    interface Serial0/1
     description link to R2
     ip address 10.12.5.1 255.255.255.0
     ip pim sparse-mode
     ip ospf 1 area 0
     clock rate 2000000
    !
    ip pim rp-address 10.224.1.1
    

    </td></tr></tbody></table></figure>

    
    Anyways. regardless of whether or not that ^^ looks sensible, I try to remove everything except the 
     

    tags. But WP tells me there is a format error. When I attempt to make a recovery it looks like its trying to turn output into a table.

    I fear the hashtag #buggeroffandlearnhtml applies in this case, but any help would be very much appreciated.

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

  • Unknown's avatar

    Right… well that didn’t work.

    It appears that I can neither edit a post AFTER I’ve posted it, nor preview it BEFORE I post it (or at least I couldn’t find said button).

    ANYWAYS… hopefully the above will at least serve as a good laugh for any html engineers out there. But if enough of it makes sense to guide me in the direction that would still be appreciated. :)

    (I work in IT, I swear)

  • Hi there!

    I’m thinking you could use Code Block instead. It will maintain the code as-is, have a look:

    https://wordpress.com/support/wordpress-editor/blocks/code-block/.

    There’s also SyntaxHighlighter Code Block if you prefer:

    https://wordpress.com/support/wordpress-editor/blocks/syntax-highlighter-code-block/.

    I hope that helps :).

    Also, remember that with your plan, you can access Live Chat directly via https://wordpress.com/help/contact. That way, you can get help faster.

  • Unknown's avatar

    Thats worked brilliantly. Thanks so much.

  • The topic ‘CLI Code indentation not working’ is closed to new replies.