我正在使用markdown来创建表格。我的描述列包含非常长的文本,因此当我换行时,它在markdown文件上看起来很糟糕:
Argument | Description |
-------- | ----------- |
appDir | The top level directory that contains your app. If this
option is used then it assumed your scripts are in |a subdirectory under this path. This option is not required. If it is not specified, then baseUrl below is the anchor point for finding things. If this option is specified, then all the files from the app directory will be copied to the dir: output area, and baseUrl will assume to be a relative path under this directory.
baseUrl | By default, all modules are located relative to this path. If baseUrl is not explicitly set, then all modules are loaded relative to the directory that holds the build file. If appDir is set, then baseUrl should be specified as relative to the appDir.
dir | The directory path to save the output. If not specified, then the path will default to be a directory called "build" as a sibling to the build file. All relative paths are relative to the build file.
modules | List the modules that will be optimized. All their immediate and deep dependencies will be included in the module's file when the build is done. If that module or any of its dependencies includes i18n bundles, only the root bundles will be included unless the locale: section is set above.
我想换行,因为它对我来说更具可读性 有没有办法让表格对编辑器更具可读性?
答案 0 :(得分:6)
还有另一种选择。由于Markdown应该是轻量级的,而不是标记语言,并且是为了人类的自然消费(与SGML / HTML风格的格式相反),我认为回归到ASCII是很好和自然的。特殊情况的艺术。
对于这项特殊任务,角色艺术很自然。因此,只需用四个空格缩进你的表格,为了便于阅读就很好地格式化它,而Markdown只会将它视为预先格式化的文本,双方都可以停止互相争斗。
例如:
| Sequence | Result |
|-------------|---------------------------------------------------------------|
| `a?c` | Matches `abc`, `axc`, and `aac`. Does not match `ac`, `abbc`, |
| | or `a/c`. |
|-------------|---------------------------------------------------------------|
| `a*c` | Matches "ac", "abc" and "azzzzzzzc". Does not match "a/c". |
|-------------|---------------------------------------------------------------|
| `foo...bar` | Matches "foobar", "fooxbar", and "fooz/blaz/rebar". Does not |
| | match "fo/obar", "fobar" or "food/bark". |
|-------------|---------------------------------------------------------------|
| `....obj` | Matches all files anywhere in the current hierarchy that end |
| | in ".obj". Note that the first three periods are interpreted |
| | as "...", and the fourth one is interpreted as a literal "." |
| | character. |
|-------------|---------------------------------------------------------------|
......完成了。
答案 1 :(得分:5)
我相信@Naor是对的:您必须使用HTML来创建换行符,尽管答案中没有说明。并且显示的完整表格代码并非绝对必要:要实现换行符,您只需要双倍空格或<br />
标记。 From the Markdown spec:
Markdown支持“硬包装”文本段落。这有所不同 从大多数其他文本到HTML格式化程序(包括 Movable Type的“转换换行”选项)可以翻译每一个 将段落中的换行符转换为
<br />
标记。如果您想使用Markdown插入
<br />
广告代码,则结束 包含两个或多个空格的行,然后键入return。
请注意,我必须在文本中添加代码包装器,因为SO风格的Markdown要求转义HTML中断标记 - 所以我们知道<br />
有效。
但是,如果你想做一些更复杂的事情,比如我*你可以用HTML设置各种属性:
<table width="300">
<tr>
<td> This is some text </td>
<td> This is some somewhat longer block of text </td>
<td> This is some very long block of text repeated to make it even longer. This is some very long block of text repeated to make it even longer. This is some very long block of text repeated to make it even longer. </td>
</tr>
</table>
我尝试将style="width:75%"
添加到<td>
,但没有任何影响。
*我应该注意到我遇到过这个因为我在使用GitHub风格的Markdown在表中编写代码时遇到了类似的问题,这非常痛苦。但是我注意到了这一点,因为它应该给我给出的例子上色:我说的任何事情都可以起作用&#39;或者&#39;不工作&#39;来自那个环境。
编辑:如果您的表中有code
个阻止,那么这可能更值得注意。这不是Markdown的问题:HTML <code></code>
块会导致表拉伸。
答案 2 :(得分:2)
遗憾的是,您必须使用HTML
<table>
<tr>
<th>Argument</th>
<th>Description</th>
</tr>
<tr>
<td>appDir</td>
<td>The top level directory that contains your app. If this option is used then
it assumed your scripts are in</td>
</tr>
<tr>
<td>baseUrl</td>
<td>By default, all modules are located relative to this path. If baseUrl is not
explicitly set, then all modules are loaded relative to the directory that holds
the build file. If appDir is set, then baseUrl should be specified as relative
to the appDir.</td>
</tr>
<tr>
<td>dir</td>
<td>The directory path to save the output. If not specified, then the path will
default to be a directory called "build" as a sibling to the build file. All
relative paths are relative to the build file.</td>
</tr>
<tr>
<td>modules</td>
<td>List the modules that will be optimized. All their immediate and deep
dependencies will be included in the module's file when the build is done. If
that module or any of its dependencies includes i18n bundles, only the root
bundles will be included unless the locale: section is set above.</td>
</tr>
</table>
答案 3 :(得分:1)
嗨,我想知道同样的事情。我需要这个文档文件,这就是我处理这个问题的方式:
| key | description |
| --- | --- |
| foo | bla bla blabla bla blabla bla bla |
| | bla bla blabla bla bla bla bla bla |
| bar | something else bla |
我同意上面提到的Sam,Markdown认为是“硬包裹”语言,因为这是作弊(我猜这不是一个有效的Markdown)。但是例如在几个Github项目README.md
文件中,我看到人们包装列表项如下:
* foo
* bla bla bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla
我的学院也指出http://www.tablesgenerator.com/markdown_tables正在包装 表格相似(谢谢汤姆)
所以我认为如果你正在做一些不会被解析的东西(比如Github文档),我可以使用我的例子,但如果你正在做一些Markdown到HTML解析器或Cucumber测试表,你就不应该换行。
但我可能错了