Code Inside List item with ``` does not work great

Issue #21 new
Elvis de Freitas created an issue

Can you fix it?

  1. This is a numbered list.
  2. I'm going to include a fenced code block as part of this bullet:

    javascript function helloWorld(){ console.log("hello World"); }

Because works only this way:

  1. This is a numbered list.
  2. I'm going to include a fenced code block as part of this bullet:
    function helloWorld(){
        console.log("hello World");
    }
    

the code

Can you fix it?

1. This is a numbered list.
2. I'm going to include a fenced code block as part of this bullet:

    ```javascript
    function helloWorld(){
        console.log("hello World");
    }
    ```

Because works only this way:

1. This is a numbered list.
2. I'm going to include a fenced code block as part of this bullet:


        function helloWorld(){
            console.log("hello World");
        }

Comments (3)

  1. Bruce Pulley Account Deactivated

    I've been having issues with this as well. The triple-backtick code blocks work fine when at the root level of the document, but chokes when embedded within a list. Furthermore, if you try to insert a non-indented code block within an ordered list, it will break the list's numbering.

    Take the following:

    1. Here's my numbered list
    2. I'm putting code within it: javascript function helloWorld(){ console.log("hello World"); }
    3. but it displays oddly.

    And the version with the un-indented code block:

    1. Here's another numbered list
    2. I'm putting code within it:
    function helloWorld(){
        console.log("hello World");
    }
    
    1. The code displays acceptably, but breaks my list.

    Source:

    1. Here's my numbered list
    2. I'm putting code within it:
        ```javascript
        function helloWorld(){
            console.log("hello World");
        }
        ```
    3. but it displays oddly.
    
    And the version with the un-indented code block:
    
    1. Here's another numbered list
    2. I'm putting code within it:
    ```javascript
    function helloWorld(){
        console.log("hello World");
    }
    ```
    3. The code displays acceptably, but breaks my list.
    
  2. Eric Jenkins

    I second this! And I would like to point out that Github is able to properly render this type of Markdown syntax. So it's definitely do-able.

  3. Log in to comment