【问题标题】:Line breaks within indented <source> tag缩进 <source> 标记内的换行符
【发布时间】:2016-10-22 00:02:31
【问题描述】:

我无法在任何地方找到答案。

我正在处理一个内部 Wiki 条目。我有想要包含在 标记中的代码。因为 标记在项目符号列表中,所以我希望它缩进。

这是我的问题:我的代码包含多行,我想在代码示例中插入换行符。但无论出于何种原因,Wiki 标记都不允许我这样做。

当我尝试插入回车时,新行的 格式消失。

当我尝试插入
标签时,标签实际上会显示出来;它不会打破界限!

到目前为止,我发现的唯一解决方法是这样的——这不是我想要的!!!

:<source lang="sql">select * from table1</source>
:<source lang="sql">select * from table2</source>

不!!!想要是这样的:

:<source lang="sql">select * from table1
select * from table2</source>

--note the line break for the second SELECT statement!
--also note the ':' that indicates that I want it indented!
--when I try it this way, the <source> formatting for the second line disappears!
--I also tried adding the ':' to the second line -- that doesn't work, either!

这个我也试过了,还是不行!

:<source lang="sql">select * from table1<br />select * from table2</source>

--when I try this, the <br /> tag actually shows up; it does NOT break the line!

换句话说,我希望两个单独的行都出现在同一个缩进 标记中。

如何让它工作?

【问题讨论】:

  • 有人吗?任何人?纽曼?

标签: wiki wiki-markup


【解决方案1】:

我发现答案是根本不使用 Wiki 标记作为项目符号列表。而是使用 HTML 标记。

例子:

<ul>
   <li>list 1</li>
   <li>list 2
      <source lang="sql">select * from table1
      select * from table2</source>
   </li>
</ul>

当我放弃使用项目符号列表和缩进的 Wiki 标记方法,转而使用直接 HTML 时,它完全符合我的要求。

【讨论】:

    猜你喜欢
    • 2015-02-09
    • 2012-05-17
    • 1970-01-01
    • 2011-05-24
    • 2016-08-23
    • 2015-08-05
    • 2011-06-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多