Backticks for code formatting

Jesse's Avatar

Jesse

22 Feb, 2011 04:55 PM

How are backticks used for code formatting? Whatever way I try, it does not render properly. Do I put the backticks at the beginning and end of each line of code? If I just use a backtick at the beginning then another at the end, some lines appear and others do not.

  1. 1 Posted by Nicole on 22 Feb, 2011 09:09 PM

    Nicole's Avatar

    Jesse -

    <code> spans are delimited by backticks. If you have code blocks I suggest using the @@@ method for code formatting. Placed at the beginning of your code and and the end on it's own line should work.

    If not, can you show us a sample of your code so we can help you troubleshoot it? Is this happening in a knowledge base article?

    Thanks,
    Nicole

  2. 2 Posted by Amanda Harasty on 25 Feb, 2011 10:47 PM

    Amanda Harasty's Avatar

    Jesse,

    Just checking back in to see if you need any additional clarification on this issue.

  3. 3 Posted by Jesse on 01 Mar, 2011 03:54 PM

    Jesse's Avatar

    Hi Amanda and Nicole,

    I get inconsistent results when I try variations of the backticks. For
    example, the following code block:

    `
    <PCNRemoteAccessResponse>
      <AgencyProgress agency_id=3D"654321">
        <course name=3D"Customer Service">
          <completed>0</completed>
          <in_progress>1</in_progress>
          <not_attempted>1</not_attempted>
        </course>
        <course name=3D"Emotional Intelligence">
          <completed>0</completed>
          <in_progress>1</in_progress>
          <not_attempted>1</not_attempted>
        </course>
      </AgencyProgress>
      <!-- ...etc for each agency -->

      <status>success</status>
    </PCNRemoteAccessResponse>
    `

    This results in the first set of lines (through "<!-...etc for each
    agency-->") formatted as code, then the tags on the last two lines
    stripped. I've tried variations of placing the backticks at different
    points and adding lines before and after, but I still can't get this
    entire block formatted as code. I have a bunch of XML I need to
    include in tickets, so formatting this cleanly is important for our
    team.

    Thanks!

    Jesse Nahan

  4. 4 Posted by Jesse on 01 Mar, 2011 03:57 PM

    Jesse's Avatar

    Hi Amanda and Nicole,

    I get inconsistent results when I try variations of the backticks. For
    example, the following code block:

    `
    <PCNRemoteAccessResponse>
      <AgencyProgress agency_id=3D"654321">
        <course name=3D"Customer Service">
          <completed>0</completed>
          <in_progress>1</in_progress>
          <not_attempted>1</not_attempted>
        </course>
        <course name=3D"Emotional Intelligence">
          <completed>0</completed>
          <in_progress>1</in_progress>
          <not_attempted>1</not_attempted>
        </course>
      </AgencyProgress>
      <!-- ...etc for each agency -->

      <status>success</status>
    </PCNRemoteAccessResponse>
    `

    This results in the first set of lines (through "<!-...etc for each
    agency-->") formatted as code, then the tags on the last two lines
    stripped. I've tried variations of placing the backticks at different
    points and adding lines before and after, but I still can't get this
    entire block formatted as code. I have a bunch of XML I need to
    include in tickets, so formatting this cleanly is important for our
    team.

    Thanks!

    Jesse Nahan

  5. 5 Posted by Nicole on 01 Mar, 2011 08:54 PM

    Nicole's Avatar

    Jesse -

    If you place @@@ on the line before and after your code, does that strip out the tags on the last two lines?

    <PCNRemoteAccessResponse>
      <AgencyProgress agency_id=3D"654321">
        <course name=3D"Customer Service">
          <completed>0</completed>
          <in_progress>1</in_progress>
          <not_attempted>1</not_attempted>
        </course>
        <course name=3D"Emotional Intelligence">
          <completed>0</completed>
          <in_progress>1</in_progress>
          <not_attempted>1</not_attempted>
        </course>
      </AgencyProgress>
      <!-- ...etc for each agency -->
    
      <status>success</status>
    </PCNRemoteAccessResponse>
    

    Let us know.

    Thanks,
    Nicole

  6. 6 Posted by Jesse on 01 Mar, 2011 09:28 PM

    Jesse's Avatar

    Hi Nicole,

    Placing @@@ on the line before and after my code snippets works great. Thanks!

    Jesse

  7. 7 Posted by Jesse on 01 Mar, 2011 09:28 PM

    Jesse's Avatar

    Hi Nicole,

    Placing @@@ on the line before and after my code snippets works great. Thanks!

    Jesse

  8. Nicole closed this discussion on 01 Mar, 2011 09:42 PM.

Discussions are closed to public comments.
If you need help with Lighthouse please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac