【问题标题】:How to put an inline comma in markdown?如何在降价中放置内联逗号?
【发布时间】:2018-03-21 00:01:53
【问题描述】:

在 Markdown 中,我如何在不计入代码的情况下放置逗号。我应该补充一点,这是在降价页面的变量部分。

例子:

array: [
  line one without comma,
  line with comma here, still the same line,
  new line
]

因此,如果我要遍历此内容,我会得到类似的结果:

line one without comma
line with comma here
still the same line
new line

【问题讨论】:

  • 我不确定我是否理解您的问题。逗号在 Markdown 中没有特殊含义。也许您可以编辑您的问题以包含实际的 HTML 输出和您想要的输出。
  • 我希望能够在此处的字符串中放置一个逗号。但这会为这个数组创建 4 个不同的字符串。
  • Markdown 无法理解和运行代码。没有array 这样的东西。您是否在 Markdown 之上使用了其他东西(如 r)?
  • 我将它与 gatsbyjs 和 graphql 一起使用。我查询它,如果我抓住变量,我可以访问这个数组。你是对的,虽然我可能需要删除这个问题或重新写它。
  • 你能用 "\n" 或 "\r" 分割吗?否则,你能逃脱常规逗号吗? line with comma here\, still the same line, 或类似

标签: markdown graphql gatsby


【解决方案1】:

在搞砸了一段时间并尝试了很多不同的事情之后,我只是尝试将行包装在 " " 中,它最终工作了。因此,如果您想在数组字符串元素中包含逗号,您只需这样做:

array: [
  line one without comma,
  "line with comma here, still the same line",
  new line
]

我的新输出如下所示:

line one without comma
line with comma here, still same line
new line

【讨论】:

    猜你喜欢
    • 2015-10-27
    • 1970-01-01
    • 1970-01-01
    • 2013-11-25
    • 1970-01-01
    • 2020-10-21
    • 1970-01-01
    • 2016-06-28
    • 2021-03-11
    相关资源
    最近更新 更多