Markdown: Problems with numbered list paragraphs containing code element

夙愿已清 提交于 2019-12-08 14:58:38

问题


I created a README.md file on GitHub and there are some markdown problems I can't find a solution to.

When I enter this (The dots represent space signs):

Instructions:..
....1. First sentence..
....2. Second sentence..

........This is some code.

....3. Third sentence..
....4. Fourth sentence

It renders to this:

Instructions:
1. First sentence
2. Second sentence

    This is some code.

3. Third sentence
4. Fourth sentence

How can I separate the code block from the numbered list?

I would also like to know how I can tell Markdown to ignore Markdown syntax so I don't have to use dots as a representation of space signs.


回答1:


How about this?

Instructions:

1. First sentence
2. Second sentence

    `This is some code.`

3. Third sentence
4. Fourth sentence

It wouldn't indent each point, however your example with the dots doesn't do it either. If the spacing between Instructions: and the rest is not what you want, you can use the double space after it and on the two following lines.

UPDATE: After a little fiddling, if you want to keep the numbering of the list and put some code that's relative to a single item on the list you should indent the code block. Also, have a new line before the first element of the list seems to help.



来源:https://stackoverflow.com/questions/19037311/markdown-problems-with-numbered-list-paragraphs-containing-code-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!