sách gpt4 ai đã đi

github markdown 拆分源表行

In lại 作者:行者123 更新时间:2023-12-04 02:53:52 27 4
mua khóa gpt4 Nike

我得到了一个非常复杂的 Markdown 表,其中包含大量列。
我想保持 linter(在我的情况下是 makdownlint )快乐并保持线条漂亮并且在 80 个字符的限制内。但是标题数据很复杂,所以我的表看起来像这样

| fooooooooooooo | baaaaaaaaar | foooooooooooo | baaaaaaaaar | fooooooooooo |
|----------------|-------------|---------------|-------------|--------------|
|1|2|3|4|5|

该表的结果是我需要并且在 GitHub 上看起来不错
我不确定这是一个好主意,但是有没有办法在源代码的行之间拆分表格单元格,但保持呈现的数据相同?

像这样的东西:
| fooooooooooooo |\
| baaaaaaaaar \
| foooooooooooo \
| baaaaaaaaar \
| fooooooooooo |

1 Câu trả lời

Nói tóm lại:KHÔNG .

GitHub 的 đặc điểm kỹ thuật不提供跨行中断行。值得注意的是行的描述:

Each row consists of cells containing arbitrary text, in which inlines are parsed, separated by pipes (|). A leading and trailing pipe is also recommended for clarity of reading, and if there’s otherwise parsing ambiguity. Spaces between pipes and cell content are trimmed. Block-level elements cannot be inserted in a table.



当然,虽然这并没有特别支持它,但它也没有明确排除跨多行打破一行。但是,请注意该语法不提供任何方式(在换行符之外)来定义一行何时结束而另一行何时开始(与标题行不同,它需要一个“分隔符行”将其与表的主体分开)。由于您无法定义行之间的划分,因此解析器可以确定一行何时结束而另一行何时开始的唯一方法是换行。

然后我们有这个问题:

The remainder of the table’s rows may vary in the number of cells. If there are a number of cells fewer than the number of cells in the header row, empty cells are inserted. If there are greater, the excess is ignored:



换句话说,解析器无法计算列数来确定下一行是前一行的延续还是新行。

最后,在其他地方,规范指出:

A backslash at the end of the line is a hard line break:



对于特定类型的内容有一些异常(exception),但在 backslash escapes 中根本没有提到表格。规范的一部分,因此不适合任何这些异常(exception)。因此,在行尾使用反斜杠转义只会强化行结束一行的事实,这与您想要的效果相反。

所以,不,没有办法跨多行包装表格行。

为了比较,请考虑 MultiMarkdown ,早在 GitHub 提供它之前就支持相同的表语法。 MultiMarkdown 的文档明确指出:

Cell content must be on one line only



此行为匹配 PHP Markdown Extra ,首先介绍了语法。事实上,我不知道这个特定表语法的任何实现支持在多行上定义一行的任何方式。

关于github markdown 拆分源表行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53896668/

27 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com