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


当前回答

在gitlab.com上,一个单独的en空间(U+2002)和一个单独的em空间(U+2003)可以正常工作。

可能其他的重复或组合的不精确的空格字符也足够了。

其他回答

为了回答MengLu和@lifebalance在回应SColvin的回答时提出的问题(我更喜欢它提供的控件的接受答案),似乎你可以在将显示设置为none时只针对列表的父元素,必要时添加一个周围元素。因此,如果我们假设我们在一个目录中这样做,我们可以扩展SColvin的答案:

HTML

<nav class="table-of-contents">
  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>
</nav>

CSS

.table-of-contents ul {
  list-style-type: none;
}

好吧,在你的R代码中有一些HTML,我做了下面的代码来在R Markdown中生成纯文本。<h3 style="text-indent: 15em;">将文本缩进15个空格。对于原来的问题,将15改为6。

## Option: Du Pont Ratio Concept - (ROE Decomposition)
### (Closed Quotes/Total Premium) = (Closed Quotes/Quotes Issued) X <br>
<h3 style="text-indent: 15em;">
 (Quotes Issued/Renewal Premium) X <br></h3>
<h3 style="text-indent: 15em;">
 (Renewal Premium/Total Premium)</h3>

因此结果代码给出了我想要的输出格式。我正在使用标签Markdown文档,并正在寻找对齐()文本工作。

使用非换行空格开始行的一个问题是,如果你的行足够长,那么当它溢出到第二行时,溢出行的第一个字符将从左开始,而不是从上一行的第一个字符开始。

如果你的系统允许你将HTML与你的markdown混合在一起,一种获得缩进的廉价和愉快的方式是这样的:

<ul>
My indented text goes here, and it can be long and wrap if you like.
And you can have multiple lines if you want.
</ul>

从语义上讲,在HTML中这是毫无意义的(一个没有任何LI项的UL节),但我所使用的所有浏览器都很乐意缩进这些标记之间的内容。

正如@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

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

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