WordPress.org

Ready to get started?Download WordPress

Forums

Source Code Indent in Visual Editor (3 posts)

  1. not2bug
    Member
    Posted 4 years ago #

    Hi there,

    I am trying to write some source code (c++) in a self hosted wordpress.
    I have been reading a ton of info in the FAQ, this support forums, and some other sites to gather information about how to properly do it.

    Most of them talk about the wonderful plugins derived from "Google Syntax Hightlighter" and how to use them. I understood that. In fact I managed the plugins to work fine. There's even another plugin called Visual Code Editor which is supposed to make the Visual editor behave better while posting source code snippets.

    And after all this info I still can properly paste source code in the posts and it's driving me mad. This is so frustrating. So here's my question:

    Is there any way in this world, to paste source code (indented, as every source code, WITH TABS) in the Visual Editor and making WP to RESPECT those tabs???? Pasting it just in the Visual Editor, using the "Plain Text" or the "Word" option, produce the same result: NO TABS.

    I mean, I have copied a source code like this:

    public void class::method(){
    TAB int var1;
    TAB int var2;
    TAB for (;;){
    TAB TAB do somth;
    TAB TAB blah blah;
    TAB }
    }

    And as soon as I paste it i have this:

    public void class::method(){
    int var1;
    int var2;
    for (;;){
    do somth;
    blah blah;
    }
    }

    Maybe I'm getting dumber with the age, but it seems impossible to me.

    Thanks guys.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Try using the HTML tab and surrounding your code with <pre></pre> tags.

  3. Nutrawee
    Member
    Posted 3 years ago #

    Thank you Esmi. It's work!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.