Kaseya Community

why can't I post code in the forum?

This question is answered

I'm using the "[" and "]" with code and /code to end it

but I only get one line encap'd in the code tags. 

 

How do I post with multi-line code tags? 



[edited by: danrche at 12:21 PM (GMT -7) on 3-29-2011] question
Verified Answer
  • Umm beer??

    Just joking I prefer scotch!

    Anyways

    Hit the "Use rich text formatting" link below then

    use the:


    [ c o d e ] tag to start


    then


    [ / c o d e ] tag to to end


    Make sure you post your code between the tags...

    For multiline stuff just hit enter (personally I [shift]+Enter, I don't like editors formatting me on their own)

  • I find that using a basic text editor like notepad also fixes bugs with the code tags, so you write both the start and stop code tags each in their own lines and copy & paste your code in between the tags then you grab the whole lot and paste it into the "Use rich formatting" text block.

    If you use MS Word you might gets some hidden formatting attributes so only use it to spell check (if you don't have a spell checker addon install for your browser) and then copy&paste it into notepad to remove the hidden formatting attributes.

    I know it sounds like a long winded way of doing it but it works...

All Replies
  • you can use the code tag, I found it works best when "Use rich formatting" option is used

  •  this is done with code tags in rich formatting

     

    and should display mulit lines of code, but it doesn't :( sadly I feel like I'm doing something wrong

     

    here is the 3rd line of code, but still not within code tags :(

  • This text is
    INSIDE
    of code tags...

    Outside of code tags.

     

     


  • Multi line of code
    Line1
    Line2
    Etc


    Outside of the code tags


    And yet more code
    And more...
    Etc

  • wow, that's great, now how'd you do it? :D

  • Umm beer??

    Just joking I prefer scotch!

    Anyways

    Hit the "Use rich text formatting" link below then

    use the:


    [ c o d e ] tag to start


    then


    [ / c o d e ] tag to to end


    Make sure you post your code between the tags...

    For multiline stuff just hit enter (personally I [shift]+Enter, I don't like editors formatting me on their own)

  • I find that using a basic text editor like notepad also fixes bugs with the code tags, so you write both the start and stop code tags each in their own lines and copy & paste your code in between the tags then you grab the whole lot and paste it into the "Use rich formatting" text block.

    If you use MS Word you might gets some hidden formatting attributes so only use it to spell check (if you don't have a spell checker addon install for your browser) and then copy&paste it into notepad to remove the hidden formatting attributes.

    I know it sounds like a long winded way of doing it but it works...

  • There is also a button in the rich text editor, that is for pasting specifically from MS Word.  Supposed this next version of the community platform (that I'm installing in a test environment next week) has better code inclusion ability.

  • this is just a test

     

    that's all it is a test

     

    if you see any of this outside the lines,

     

    then I still can't post multilines of code on this forms


  • Seems to work here.
    What browser are you using, danrche?  That's the only other thing I can think of...

    Outside
    inside
    Outside again
    muli line test

    inside again
    muli line test again
     
     /scratches head (outside)

  • I use chrome

     

     but it doesn't seem to matter

     

    even with IE9

     

    or firefox

     

    I even tried copying and pasting from notepad, same results

     

    I'm cursed :(

  • Aha.. I think I see that the problem is.  The [ code ] tag gets broken by new paragraph html tags.

    Examples:

    Will display correctly:


    <p>[code]<br />this is<br />code<br />in[ /code]&nbsp;</p>

    Will break:


    <p>[code]</p>
    <p>this is</p>
    <p>code</p>
    <p>in</p>
    <p>[ /code]</p>

     

    This issue stems from the way the forum software handles you pressing the enter key in the rich text editor.  When you press return, it starts a new  paragraph using the < P > html tag, which is breaking the [ code ] tag.

    What you need to do, until the forum software is fixed, is use SHIFT+ENTER instead of just ENTER.  SHIFT+ENTER will insert a line break, "< br >" instead of a new paragraph.

    To end your code tag, you need to end it on the last line, not on a line by itself.

    So, for success do this:

    [ code ] <SHIFT+ENTER>
    What you want in side of code tags, <SHIFT+ENTER>
    use SHIFT+ENTER for new line and then immedately end your code tag on the last line - not on a line by itself like so... [ / code ]

     

    The notepad composing trick works because of the new paragraph vs line break described above.

    Maybe this info can be passed to the forum developers to they know where to start in order to fix it.