Skip to main content
added 131 characters in body
Source Link
Eric
  • 2.4k
  • 14
  • 25

I'm aware that I can do this:

  1. This code is python:

     print "Hello"Hello"
     World"print "World"
    
  2. And this is javascript:

     console.log("Hello"Hello")
     World"console.log("World")
    

But is it possible to correctly format this?

  1.  print "Hello"Hello"
     World"print "World"
    

    That code was python:

  2.  console.log("Hello"Hello")
     World"console.log("World")
    

    And that was javascript:

Which I've marked up as:

1.      print "Hello"Hello"
 World"       print "World"

    That code was python

2.      console.log("Hello"Hello")
 World"       console.log("World")

    And that was javascript

Currently, my attempts either:

  • Drop the numbering for no obvious reason
  • Result in a blank line before the code block
  • Work only for a single line of code using `s

I'm aware that I can do this:

  1. This code is python:

     print "Hello World"
    
  2. And this is javascript:

     console.log("Hello World")
    

But is it possible to correctly format this?

  1.  print "Hello World"
    

    That code was python:

  2.  console.log("Hello World")
    

    And that was javascript:

Which I've marked up as:

1.      print "Hello World"

    That code was python

2.      console.log("Hello World")

    And that was javascript

Currently, my attempts either:

  • Drop the numbering for no obvious reason
  • Result in a blank line before the code block
  • Work only for a single line of code using `s

I'm aware that I can do this:

  1. This code is python:

     print "Hello"
     print "World"
    
  2. And this is javascript:

     console.log("Hello")
     console.log("World")
    

But is it possible to correctly format this?

  1.  print "Hello"
     print "World"
    

    That code was python

  2.  console.log("Hello")
     console.log("World")
    

    And that was javascript

Which I've marked up as:

1.      print "Hello"
        print "World"

    That code was python

2.      console.log("Hello")
        console.log("World")

    And that was javascript

Currently, my attempts either:

  • Drop the numbering for no obvious reason
  • Result in a blank line before the code block
  • Work only for a single line of code using `s
Source Link
Eric
  • 2.4k
  • 14
  • 25

How can I start a list item with a code block?

I'm aware that I can do this:

  1. This code is python:

     print "Hello World"
    
  2. And this is javascript:

     console.log("Hello World")
    

But is it possible to correctly format this?

  1.  print "Hello World"
    

    That code was python:

  2.  console.log("Hello World")
    

    And that was javascript:

Which I've marked up as:

1.      print "Hello World"

    That code was python

2.      console.log("Hello World")

    And that was javascript

Currently, my attempts either:

  • Drop the numbering for no obvious reason
  • Result in a blank line before the code block
  • Work only for a single line of code using `s