【问题标题】:Markdown and HTML code errorMarkdown 和 HTML 代码错误
【发布时间】:2014-12-29 06:53:43
【问题描述】:

当我尝试在 Marldown 中编译以下 html 代码时

<table id="toc" class="toc">
<tr>
<td>
<div id="toctitle">
<h2>Contents</h2>
</div>
<ul>
<li>[toto](#toto)</li>
<li>[tata](#tata)</li>
<li>[titi](#titi)</li>
</ul>
</td>
</tr>
</table>

使用命令:

 perl Markdown.pl --html4tags toto.md > toto.html

我在 HTML 页面中得到类似的东西:

Contents
[toto](#toto)
[tata](#tata)

而 MOU 软件或像 Dillinger 这样的在线软件提供了正确的结果(只有 toto 和 tata 没有括号......) 我用 Markdown 代码写表格时也遇到了同样的问题。

有人知道它可能来自哪里吗?

感谢您的帮助

【问题讨论】:

  • 我无法复制您遇到的问题,但也许您使用的是不同的 Markdown 解析器。你能不能输入less $(which Markdown.pl) 看看第四行是不是use Text::Markdown qw(markdown);。如果没有,最好指出您正在使用什么解析器以及您从哪里获得它。
  • 它返回“缺少文件名(“less --help”寻求帮助)”我应该错过一些东西。对不起,我是初学者...
  • 尝试安装 Text::Markdown (cpan Text::Markdown) 并从那里使用 Markdown.pl(你应该可以在没有 perl 的情况下调用它,即 Markdown.pl toto.md
  • 我的 cpan 出现了一些问题,但现在可以了。我确认第四行是使用 Text::Markdown qw(markdown);即使使用 Markdown.pl toto.md,我仍然有相同的结果

标签: html markdown


【解决方案1】:

第 11 行的 &lt;/li&gt; 不应该在那里,删除它。

【讨论】:

  • 抱歉,这是一个复制粘贴错误。它不会改变问题。
  • 只是想知道 - 你为什么要使用表格来进行 html 标记?!你有没有在表格前后放一个空行,这是 Markdown 想要的?
  • 对不起我的错误,我当然是用 Markdown 写的。我得到这样的东西:|表 |是 |酷 | |---------|:-------------:|------:| |第 1 列是 |左对齐 | 1600 美元 | |第 2 列是 |居中 | 12 美元 | |第 3 列是 |右对齐 | $1 |
猜你喜欢
  • 1970-01-01
  • 2016-03-27
  • 1970-01-01
  • 1970-01-01
  • 2016-04-10
  • 2016-02-02
  • 2011-04-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多