我想写几行文字。除了每行从第6列开始之外,它们应该正常格式化。例如,我不希望代码块格式规则使这一文本块看起来像代码,因为我将使用其他格式,如粗体面等。如何在Markdown中做到这一点?
当前回答
为了回答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;
}
其他回答
令人惊讶的是,还没有人提出只使用带填充的div的想法,所以你可以这样做:
<div style="padding-left: 30px;">
My text
</div>
对于引用/缩进的段落,这个hack可能会工作(取决于渲染引擎):
| | | |
|-|-|-|
| | _"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."_ | |
|
呈现为:
另一种选择是使用像StackEdit这样的降价编辑器。它将html(或文本)转换为所见即所得编辑器中的markdown。您可以在编辑器中创建缩进,标题,列表,它将以markdown格式显示相应的文本。然后您可以保存、发布、共享或下载该文件。你可以在他们的网站上访问它-不需要下载!
正如@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以缩进文本的形式呈现。
如果你不想要标题/术语,只需使用一个不间断的空格来代替定义术语:
: 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
markdown的原生功能无法做到这一点。然而markdown允许内联HTML,因此编写
This will appear with six space characters in front of it
会产生:
这将在它前面显示六个空格字符
如果您可以控制页面上的CSS,还可以使用标记和样式,可以使用内联或CSS规则。
不管怎样,降价并不是作为一个布局的工具,它是为了简化网络写作的过程,所以如果你发现自己扩展了它的功能集来做你需要做的事情,你可能会看看你是否使用了正确的工具。看看格鲁伯的文件:
http://daringfireball.net/projects/markdown/syntax#html
推荐文章
- 如何在Atom中更改缩进模式?
- 如何缩进/格式选择的代码在Visual Studio代码?
- 如何将LaTeX与Markdown混合?
- 在Python中格式化多行字典的正确方法是什么?
- 乳胶渲染在README。md在Github上
- git可以自动在空格和制表符之间切换吗?
- 在Markdown Jekyll中使用图像说明
- Slack Markdown链接没有解决
- 差异语法突出显示在Github Markdown
- 我如何创建一个文本框的笔记在markdown?
- 在Markdown中创建一个没有标题的表
- R -降价避免包装加载消息
- 在MarkDown中包含SVG(托管在GitHub上)
- 如何修复/转换崇高文本的空间缩进?
- 自动TOC在github风味markdown