2017-11-10 141 views
0

我有以下的降价片断,这将是在Github上可见:不正确的嵌套列表格式

1. Ask a supervisor for a `cmprod.pem` file and move it into the `~/.ssh` folder. 
2. Run `chmod 600 ~/.ssh/cmprod.pem` 
3. Run `eb ssh` and type `yes` when it asks if you would like to add the key to your keychain. 
4. Once connected via SSH, to access the application's source code, perform the following steps 
   - `sudo docker ps` 
   - Copy the desired value from the `CONTAINER ID` column 
    - Run `sudo docker exec -it $CONTAINER_ID rails c` using the copied value. 

的问题是,嵌套列表(第4步下三个要点)是不正确的格式。他们最终看起来像这样:

  1. 向主管的cmprod.pem文件,并将其移动到文件夹~/.ssh
  2. 运行chmod 600 ~/.ssh/cmprod.pem
  3. 运行eb sshyes类型时,它问你是否想将键添加到您的钥匙串。
  4. 通过SSH一旦连接,来访问应用程序的源代码,执行以下步骤 - sudo docker ps - 使用复制的值从CONTAINER ID
    • 运行sudo docker exec -it $CONTAINER_ID rails c所需的值复制。

回答

1

这取决于您正在使用哪个规则集。根据GitHub使用的Commonmark(我假设这是因为[github]标签而相关的),“列表可以中断一个段落,也就是说,不需要空行来将段落与下面的列表分开。 “规范的Example 280甚至显示了一个类似于你的例子。如果它不适合你使用Commonmark解析器,那么这将是一个错误。

但是,如果您不使用Commonmark(或作为任何Commonmark错误的解决方法),那么Markdown规则要求您在列表和上一段落之间有一个空行。由于父母名单第4项中的文本将是一个段落(在列表项目内),因此该段落和该段落后面的子列表项目之间需要有一个空行。像这样:

1. Ask a supervisor for a `cmprod.pem` file and move it into the `~/.ssh` folder. 
2. Run `chmod 600 ~/.ssh/cmprod.pem` 
3. Run `eb ssh` and type `yes` when it asks if you would like to add the key to your keychain. 
4. Once connected via SSH, to access the application's source code, perform the following steps 

    - `sudo docker ps` 
    - Copy the desired value from the `CONTAINER ID` column 
    - Run `sudo docker exec -it $CONTAINER_ID rails c` using the copied value. 

记住当嵌套列表项时,你需要遵循所有在列表之外的规则。然后缩进一个级别。因此,举例来说,一切都嵌套在第4项是这样的外部列表项:

Once connected via SSH, to access the application's source code, perform the following steps 

- `sudo docker ps` 
- Copy the desired value from the `CONTAINER ID` column 
- Run `sudo docker exec -it $CONTAINER_ID rails c` using the copied value. 

您需要的段落和列表之间的空行。因此,将所有内容嵌套到列表中时,您需要保持相同的格式并保留空白行。仅仅因为第一行从子弹(或列表号)开始并不意味着它不遵循相同的规则。

最后,即使您使用的是Commonmark解析器,我也会建议使用空白行。这是任何Markdown棉绒都会提出的一种很好的形式。

+0

我试着粘贴你的第一个片段,它的工作原理与上述相同。但我不明白为什么它不适用于我的MD文件。你可以看看这个,让我知道如何编辑它,所以最后列表格式正确? https://gist.github.com/maxp-edcast/9d7bbf0e28a4666dc2b492403cbc5d3b –

+0

删除您的子列表中项目2前面的缩进并键入四个新空格。四个空格中的两个实际上并不是空格,而是非空格(Unicode字符“xa0”),这使Markdown变得混乱。事实上,每当嵌套列表不起作用时,我总是首先检查缩进。我在回答(通过计数)之前检查了你的,但没有注意到不间断的空格字符。当我发布我的答案时,我删除了缩进并重新创建了它,所以我没有遇到你的问题。 – Waylan

+0

顺便说一句,我发现你的问题,在适当的文本编辑器中打开你的文件,然后打开所有隐藏的字符。它立即显示了两个非破坏空间与文档中的所有其他空间不同。 – Waylan