2

I was trying to post this answer: https://gis.stackexchange.com/a/44735/442

The answer has some code which has angular brackets. When I tried using the code sample button, the < & > interfered with the markup.

I also tried using the html equivalents: "&lt;" and "&gt;" They work fine when you don't apply any formatting, but if you apply the 'code sample' button, the html entities are shown and not the angular brackets.

How do I post angular brackets in code?

UPDATE

I am not exactly sure why I could not format it correctly earlier, but you can see it in the revision history.

Here is a diagram showing the issue

I think it might be due to the bullets before it. I will submit that as a different question.

| |
  • I have edited your question to include the code, but experienced no markup problems. Could you provide more details of what happened, or perhaps insert a screen shot? – whuber Dec 26 '12 at 17:08
  • @whuber Thank you for the edit. I have updated the question with more details. I think the Issue might be in the bullets before the actual code. – Devdatta Tengshe Dec 27 '12 at 3:26
5

The angle brackets were not the problem. When a sequence of numbered or bulleted paragraphs appears, you need to indent the code once for each level of numbering/bulleting and then indent it by four more spaces to indicate that it's code.

Indenting is indicated by a sequence of about three spaces for each level (the actual number of spaces can vary a little). In practice, some experimentation is needed to determine how many spaces to use to achieve a desired level of indentation. That's what the real-time preview is for.

Examples:

  1. The source of this text is not indented. Because it begins with a number, it is displayed as numbered (sequentially) and it is displayed with a small indentation.

    This text is indented (by three spaces in the source): therefore it is considered part of item #1 and it is displayed to line up with the preceding paragraph.

    This text is marked as code because it has been indented four spaces **relative
    to the preceding paragraphs.**  Four spaces (exactly) are always needed to
    indicate a paragraph contains code.
    

    This text is marked as a quotation. To justify it with the preceding text, it was preceded by just a single space.

  2. This text is not indented, but it begins with a number: therefore it is treated as the next paragraph in the numbered sequence. (The number it begins with is not "2": the system assigns numbers sequentially, regardless of the value you type.)

    • This text is not indented, but begins with an asterisk. It is therefore interpreted as a bulleted item, and shown indented relative to the current indentation level.

      This text is doubly indented (by six spaces). The double indentation indicates it should be displayed at the level of the preceding bullet.

      This text is triply indented (it took around 12 spaces).  It is now 
      interpreted as *code* at the level of the preceding bulleted item.
      

    This text is only singly indented (by two or three spaces). That indicates it should be displayed at the level of the preceding numbered paragraph.

    • This text is not indented, but begins with an asterisk. It is therefore interpreted as another bulleted item and is justified with the preceding bulleted item.

This text is not indented. That terminates the numbered paragraphs.

  • This text is not indented, but begins with an asterisk. It is therefore interpreted as a bulleted item, and shown indented relative to the current indentation level.

This text is not indented. That terminates the bulleted sequence.

This text is only singly indented (by four spaces), indicating it is code.
| |
  • 2
    Thanks for the detailed explanation! – Devdatta Tengshe Dec 28 '12 at 3:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .