-2

<pre> tags are lined up with my bullet indents in the code preview, but not in the answer.

enter image description here

7
  • 4
    Any reason why you're using <pre> instead of backticks(``)?
    – Sathyajith Bhat Mod
    Commented Jul 28, 2011 at 17:18
  • I think this has been asked before and the fix was to use Markdown approved markup
    – Ivo Flipse Mod
    Commented Jul 28, 2011 at 17:23
  • I figured out a solution: using <ul> and <li> to nest things. I've never used backticks on this site before. do they do the same thing as <pre>?
    – Gruzzles
    Commented Jul 28, 2011 at 17:24
  • @Senoculus For a single line, yes, they do. Also, It's preferred to use Markdown formatting
    – Sathyajith Bhat Mod
    Commented Jul 28, 2011 at 17:28
  • 1
    also, please keep the question and answer separate @Senoculus. Use the answers section for your answer
    – Sathyajith Bhat Mod
    Commented Jul 28, 2011 at 17:36
  • @Sathya Thanks for the feedback. I was using <pre> tags because it puts a blue line on the left margin. Backticks do not provide enough differentiation between normal text and code.
    – Gruzzles
    Commented Aug 1, 2011 at 20:49
  • well, +1 for the awesome screenshot in the post :) Commented Aug 1, 2011 at 21:11

2 Answers 2

8

Indent 8 spaces if you want code inside bulleted lists.

See https://superuser.com/editing-help for details.

1
  • This solves my problem as far as usability goes, so I'll accept your answer, but I still don't know why the preview would differ from the actual post.
    – Gruzzles
    Commented Aug 1, 2011 at 21:07
-1

Using Nested <ul> and <li> tags:

Code:

<ul>
    <li>bullet 1
        <pre>code 1</pre>
        <ul>
            <li>subpoint 2
                <pre>code 2</pre>
            </li>
        </ul>
    </li>
</ul>

Result:

  • bullet 1
    code 1
    • subpoint 2
      code 2

Using Markdown Formatting:

Code:

- bullet 1
    <pre>code 1</pre>
 - bullet 2
        <pre>code2</pre>

Result:

  • bullet 1
    code 1
    • bullet 2
      code2

You must log in to answer this question.

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