我想写几行文字。除了每行从第6列开始之外,它们应该正常格式化。例如,我不希望代码块格式规则使这一文本块看起来像代码,因为我将使用其他格式,如粗体面等。如何在Markdown中做到这一点?


当前回答

令人惊讶的是,还没有人提出只使用带填充的div的想法,所以你可以这样做:

<div style="padding-left: 30px;">
My text
</div>

其他回答

一些Markdown实现似乎使用~字符进行缩进。

直接使用一个不间断的空格(不一样!)

(你可以插入HTML或一些深奥的降价代码,但我可以想出更好的理由来打破与标准降价的兼容性。)

正如@AlexDupuy在评论中指出的,定义列表可以用于此。

这不是所有的降价处理器都支持,但广泛可用:降价指南-定义列表

Term 1
: definition 1
: definition 2

Term 2
: definition 1
: definition 2

呈现为(html):

<dl>
    <dt>Term 1</dt>
    <dd>definition 1</dd>
    <dd>definition 2</dd>
    <dt>Term 2</dt>
    <dd>definition 1</dd>
    <dd>definition 2</dd>
</dl>

通常,DT以类似标题的格式呈现,而每个DD以缩进文本的形式呈现。

如果你不想要标题/术语,只需使用一个不间断的空格来代替定义术语:

&nbsp;
: This is the text that I want indented.  All text on the same line as the preceding colon will be included in this definition.
: If you include a second definition you'll get a new line; potentially separated by a space. <br />Some inline HTML may be supported within this too, allowing you to create new lines without spaces.
: Support for other markdown syntax varies; e.g. we can add a bullet list, but each one's wrapped in a separate definition term, so the spacing may be out.
: - item 1
: - item 2
: - item 3

你可以复制粘贴上面的例子到这个站点:Stack Edit Markdown Editor

一种方法是使用项目符号,它允许您指定多个缩进级别。项目符号用两个空格、星号和另一个空格的倍数插入。

this is a normal line of text
  * this is the first level of bullet points, made up of <space><space>*<space>
    * this is more indented, composed of <space><space><space><space>*<space>

这种方法有一个很大的优点,那就是当您查看原始文本时,它也很有意义。

如果你不想看到项目符号本身,你应该(取决于你在哪里使用markdown)能够为整个标记下来的区域在css中添加li {list-style-type: none;}。

检查您是否可以使用HTML与您的markdown。也许这对你有用:

列出条目1 <br/> 缩进行< br / > < br / > 还有更多… 第二个条目 分项< br / > 你好!