是否可以将表格置于降价文件中?

时间:2014-06-09 19:27:50

标签: markdown github-flavored-markdown apiblueprint apiary.io

我有一张桌子:

    | This | Is | A | Table |
    | :--- | -- | - | ----: |
    | foo  | ba | r | elbaT |

我希望该表格显示在我的Markdown文件的中心而不是左对齐。我不是要对齐文本,而是整个表本身。我是否需要使用HTML / CSS来实现我想要的目标?

这是针对Apiary.io项目的。

4 个答案:

答案 0 :(得分:23)

如果您使用标准文档,请使用<center>标记,如此。

蓝图

FORMAT: 1A
HOST: http://www.google.com

# Tables
Notes API is a *short texts saving* service similar to its physical paper presence on your table.

<center>

| Tables   |      Are      |  Cool |
|----------|:-------------:|------:|
| col 1 is |  left-aligned | $1600 |
| col 2 is |    centered   |   $12 |
| col 3 is | right-aligned |    $1 |

</center>

# Group Notes

(...)

预览


如果您使用'New Documentation',则无法将表居中(因为该表占据了列的整个宽度)。< / p>

预览

答案 1 :(得分:6)

是。您可以在API蓝图中使用GFM表 - 检查http://docs.tables.apiary.io以获取蓝图源的渲染版本。

FORMAT: 1A

# Tables API 
Note: Tables can be handcrafted or generated at <http://www.tablesgenerator.com/markdown_tables>.

## Table 1
**Discussion option 1**

| Tables   |      Are      |  Cool |
|----------|:-------------:|------:|
| col 1 is |  left-aligned | $1600 |
| col 2 is |    centered   |   $12 |
| col 3 is | right-aligned |    $1 |

# Message [/pages]
## Create a Message [POST]

### Table 2
**Discussion option 2**

| Tables   |      Are      |  Cool |
|----------|:-------------:|------:|
| col 1 is |  left-aligned | $1600 |
| col 2 is |    centered   |   $12 |
| col 3 is | right-aligned |    $1 |

+ Request (application/json)

    ## Table 3
    **Discussion option 3**

    | Tables   |      Are      |  Cool |
    |----------|:-------------:|------:|
    | col 1 is |  left-aligned | $1600 |
    | col 2 is |    centered   |   $12 |
    | col 3 is | right-aligned |    $1 |

    + Headers

            Authorization:Bearer tokenString

    + Body

            { ... }

+ Response 201

答案 2 :(得分:5)

My solution detailed by Gaffney in an Apiary.io issue comment

基本上我在apiary.apib HTML块中添加自定义样式表和脚本来使用HTML设置页面样式,而不是标记Markdown di ale ct不是CSS。

"How to Center Anything in CSS"

答案 3 :(得分:4)

很简单。如您所知,“ |-|” 用于指示表格,而“:” 用于指示文本对齐方式。如果输入 |:-| ,则该文本为右对齐文本列。如果输入 |-:| 是左对齐文本,如果输入 | ::: 是居中对齐。