Markdown pandoc是否在页面或章节底部添加了HTML脚注?

Markdown pandoc是否在页面或章节底部添加了HTML脚注?,markdown,pandoc,Markdown,Pandoc,我已经开始在降价中使用内联脚注: Some text^[an aside here]. More text. 当我使用pandoc导出为HTML时,它们显示在整个文档的末尾,但在PDF中,它们显示在页面的末尾。我更喜欢将它们放在页面的末尾,我想知道是否有一种方法可以让它们以HTML的形式出现 我意识到页面的结尾会因为HTML而变得复杂;这一节的结尾对我来说也同样适用。事实上,将它们放在PDF的部分末尾,而不是页面的末尾,也可能很有用。(我试着把--作为分节符,但脚注仍然放在文档的末尾。) (我

我已经开始在降价中使用内联脚注:

Some text^[an aside here]. More text.
当我使用pandoc导出为HTML时,它们显示在整个文档的末尾,但在PDF中,它们显示在页面的末尾。我更喜欢将它们放在页面的末尾,我想知道是否有一种方法可以让它们以HTML的形式出现

我意识到页面的结尾会因为HTML而变得复杂;这一节的结尾对我来说也同样适用。事实上,将它们放在PDF的部分末尾,而不是页面的末尾,也可能很有用。(我试着把
--
作为分节符,但脚注仍然放在文档的末尾。)

(我也尝试过制作pdf,然后是
pdf2html
,这种方式很有效,但对眼睛来说很难。Pandoc似乎不支持pdf到html,我得到了“无法解码字节”\xd0'…”)



(这不是一个重复:这个问题是关于从另一种格式转移到降价格式时脚注的处理方式。)

对于一个(打印的)页面(我自己也在寻找),不知道该怎么做,但是对于按节的脚注,你能不能在将输入文档传递给pandoc之前将其分成几节,然后再重新组装零件

例如,假设您的降价文件如下(myfile.md):

然后您可以使用,例如,以下PHP脚本(尽管我确信有一百万种方法可以做到这一点),即
pandoc sections.PHP

<?php

$input_file = $argv[1];

if (!file_exists($input_file)) {
    exit('File not found.');
}

$chunks = preg_split('/\n-----*\n/',file_get_contents($input_file));

for ($i=0; $i<count($chunks); $i++) {
    $chunk = $chunks[$i];
    $idprefix = "section" . ($i+1);

    $descriptorspec = array(
      0 => array("pipe", "r"), // stdin
      1 => array("pipe", "w"), // stdout 
      2 => array("pipe", "w")  // stderr
    );

    $pandoc_process = proc_open('pandoc --id-prefix=' . 
         $idprefix, $descriptorspec, $pipes);

    if (is_resource($pandoc_process)) {
      fwrite($pipes[0], $chunk);
      fclose($pipes[0]);
      echo stream_get_contents($pipes[1]);
      fclose($pipes[1]);
      fclose($pipes[2]);
      proc_close($pandoc_process);
   }

}    

?>

根据需要进行调整。

可能重复嘿,我刚刚暴露了一个错误,当使用“-id prefix”选项时,pandoc如何处理反向链接。我将提交一份错误报告。他们修理东西很快。
<?php

$input_file = $argv[1];

if (!file_exists($input_file)) {
    exit('File not found.');
}

$chunks = preg_split('/\n-----*\n/',file_get_contents($input_file));

for ($i=0; $i<count($chunks); $i++) {
    $chunk = $chunks[$i];
    $idprefix = "section" . ($i+1);

    $descriptorspec = array(
      0 => array("pipe", "r"), // stdin
      1 => array("pipe", "w"), // stdout 
      2 => array("pipe", "w")  // stderr
    );

    $pandoc_process = proc_open('pandoc --id-prefix=' . 
         $idprefix, $descriptorspec, $pipes);

    if (is_resource($pandoc_process)) {
      fwrite($pipes[0], $chunk);
      fclose($pipes[0]);
      echo stream_get_contents($pipes[1]);
      fclose($pipes[1]);
      fclose($pipes[2]);
      proc_close($pandoc_process);
   }

}    

?>
<p>Some text with a footnote.<a href="#section1fn1" class="footnote-ref" id="section1fnref1"><sup>1</sup></a></p>
<section class="footnotes">
<hr />
<ol>
<li id="section1fn1"><p>First note.<a href="#section1section1fnref1" class="footnote-back">↩</a></p></li>
</ol>
</section>
<p>Some more text with a footnote.<a href="#section2fn1" class="footnote-ref" id="section2fnref1"><sup>1</sup></a></p>
<section class="footnotes">
<hr />
<ol>
<li id="section2fn1"><p>Second note.<a href="#section2section2fnref1" class="footnote-back">↩</a></p></li>
</ol>
</section>
<p>And a third passage.<a href="#section3fn1" class="footnote-ref" id="section3fnref1"><sup>1</sup></a></p>
<section class="footnotes">
<hr />
<ol>
<li id="section3fn1"><p>Third note.<a href="#section3section3fnref1" class="footnote-back">↩</a></p></li>
</ol>
</section>