gitlab - GitLab 编辑器中的 Markdown : combine bullet list with multi-line code

标签 gitlab markdown

我正在尝试使用项目符号列表在 GitLab 编辑器中编写 Markdown(用于 wiki),项目符号列表可能包含多行代码。

我尝试使用此代码:

- Test
```javascript
var somecode = 5;
somecode++;
```
- Another line

但这给了我奇怪的结果:

screenshot - multi-line code starts in the same line as the first bullet point

如果我在 -``` 之间添加一个额外的空行:

- Test

```javascript
var somecode = 5;
somecode++;
```
- Another line

我得到了更好的结果,但是代码与项目符号列表不一致:

screenshot of the result - code is not aligned with bullet list

以下是预期结果:

expected result

如何实现鞋面设计? (代码右侧有边距,与项目符号列表内容对齐。)

最佳答案

您应该在多行代码之前使用一个空行和四个空格:

- Test

    ```javascript
var somecode = 5;
somecode++;
```
- Another line

结果:

result of the formatting

关于gitlab - GitLab 编辑器中的 Markdown : combine bullet list with multi-line code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49569874/

相关文章:

git - 克隆使用 git lfs 且一直不提供密码的 gitlab 项目

html - 如何转义 MathJax 的双反斜杠?

angularjs - 在 angularJS 中,如何将包含标记的模型渲染为标记(未转义)

windows - 检查其他系统中 Git 存储库的状态

linux - 客户端 git hooks 在服务器中的位置在哪里

api - gitlab API是否有速率限制

一起运行 R Markdown (check.Rmd ) 和 R knit (test.Rnw ) 文件

git - 如何将 VS Mac 连接到 GitLab 存储库?

html - 为网页提供独立的可滚动目录 Pane

r - 以编程方式将多个图像包含到 Markdown 文档中