• The "Code" feature is practically useless

    Home » Forums » Frequently asked questions, feedback, suggestions » Tips for using the Forum » The "Code" feature is practically useless

    Author
    Topic
    #104579

    I imagine the button is supposed to make it possible to surround some, well, code with formatting characters that make it display in a fixed pitch font, with spacing and such intact.

    It doesn't. That's kind of a problem on a technical site, where someone might want to list commands, etc.

    Without formatters...

    Mary had a little lamb, little lamb,
    little lamb, Mary had a little lamb
    whose fleece was white as snow.
    And everywhere that Mary went
    Mary went, Mary went, everywhere
    that Mary went
    The lamb was sure to go.

    With formatters around the entire thing, which in the editor looks just like the above:

    
    Mary had a little lamb, little lamb,
    little lamb, Mary had a little lamb
    whose fleece was white as snow.
    And everywhere that Mary went
    Mary went, Mary went, everywhere
    that Mary went
    The lamb was sure to go.
    

    -Noel

    1 user thanked author for this post.
    Viewing 2 reply threads
    Author
    Replies
    • #104603

      If you were wanting to get on top of this (rather than having it fixed by magic wand, that is), this resource may help you 🙂

      It includes several links to further information, as well as troubleshooting suggestions, and explantions, such as:

      “A frequent problem when using codes within your post is the quotes auto-correction feature of WordPress”

      “If you have long lines of code, consider showcasing only excerpts and providing a link to the full code placed on your site in a text or PHP file, or using one of the many online pastebins which are available for temporarily showcasing code.”

      “…the way a piece of code written or pasted to WordPress post editor is interpreted depends on whether you use visual or HTML post editor. Visual editor will consider the code to be an ordinary text … HTML editor does not convert any of these characters…”

      Not sure if that is any help to you at all, though.

      EDIT  Our Visual editor does not feature a code option…

      3 users thanked author for this post.
      • #104645

        Pressing the [ code ] button in the Text (not Visual) editor should just work. It doesn’t.

        It’s almost working but simply eating the newline characters. That’s the first problem, though spacing seems to be a more minor issue as well. It didn’t occur to me to try some other tag. Perhaps if any of the other ones work that button should be changed.

        Pressing the [ code ] button in the Text editor actually puts upper-left to lower-right slanted single quote characters around text, which is what I tried to use above. I hadn’t tried the other named tags, because it’s not intuitive that some half-baked html should be expected to work. Am trying that now…

        Between < pre > and < /pre > tags (without spaces):

        First line at left margin
            This second line is indented
            This third line is indented & has a path:  C:\Windows\System32
        Last line at left margin
        

        That worked.

        As an old school “by hand” html coder remembering to do the above isn’t a big deal for me, but I think fixing the buttons above the edit box to provide the above functionality would be nice for general users.

        Another thing I noticed is that the [ ul ] button doesn’t actually give a proper underline.

          This line is surrounded by < ul > and < /ul > tags.

        I don’t see anything underlined. This looks like a problem with the CSS.

        -Noel

        1 user thanked author for this post.
    • #240492

      The WordPress interface “code” button simply inserts the glyph found on the QWERTY-US keyboard next to the numeral [1] key, unshifted. (shift creates the tilde) Some individuals think it is an accent grave, others see it as a left-single-quote or inverted comma.
      No matter what you name it, entering that single character by manual keystroke is interpreted by WordPress as a toggle switch, moving you into and out of the ‘code’ presentation box. e.g. I will here mark an inverted comma, type hello, and mark a second identical inverted comma hello this additional test shows a positive return to normal text.

    • #313727

      anonymous in post #240492

      WordPress interface “code” button simply inserts the glyph found on the QWERTY-US keyboard next to the numeral [1] key, unshifted. …entering that single character by manual keystroke is interpreted by WordPress as a toggle switch, moving you into and out of the ‘code’ presentation box.

      You are correct as to what key stroke to use, and that it creates the * ‘code’ presentation box *. But, that *Code* function and it’s presentation box is non-functional. Why? Because the text editor for replies will strip any actual *code* from the *presentation box*.

      The *Code* function is supposed to allow one to type in actual code, and have it preserved inside the presentation box so others can see what actually needs to be typed-in to cause a certain coding function to occur. And, whatever code you have typed into that box is supposed to be trapped inside the box, and is supposed to not be acted upon by the forum software. But, none of that happens. The Text Editor simply strips out the code inside your *code* toggle.

      Only pure *text* without any code function will be left inside the *code presentation box*. So, it does not function as originally conceived. It has been neutered by some recent programmer who must have thought sharing *code* on a forum was too dangerous. Well, maybe so–but this forum uses bbCode–how else can one share code with others so they can use it on this forum. There are always trade-offs I’m afraid.

      NightOwl

    Viewing 2 reply threads
    • The topic ‘The "Code" feature is practically useless’ is closed to new replies.