在Pandoc Markdown输出中生成内联而不是列表样式的脚注? [英] Generate inline rather than list-style footnotes in Pandoc Markdown output?

查看:88
本文介绍了在Pandoc Markdown输出中生成内联而不是列表样式的脚注?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当从某种格式(例如HTML或Docx)转换为Pandoc中的Markdown时,可以用内联样式(这是主要文本^ [这是一个脚注]")呈现所有脚注,而不是在文件末尾标有编号的参考文献和相应的清单?我想将Markdown文档(从论文的Docx转换而来)作为主要文本进行处理,但是现在,如果我添加新的脚注,则会弄乱编号.

When converting from some format (say, HTML or Docx) to Markdown in Pandoc, is it possible to render all footnotes in the inline style ("this is the main text^[this is a footnote]") rather than as numbered references with a corresponding list at the end of the document? I want to work on my Markdown documents (converted from a Docx of my thesis) as master texts, but now if I add a new footnote it messes up the numbering.

或者,还有另一种便捷的方法(即不是Pandoc)可以做到这一点吗?在文件的一个部分中剪切文本,然后在另一部分中添加相应的文本似乎超出了简单的正则表达式.

Alternatively, is there another convenient way (i.e. not Pandoc) that this could be done? Cutting text in one part of a file and adding corresponding text in another part seems a bit beyond a simple regex.

在此先感谢您的帮助.

我刚刚破解了一个非常简单的Python脚本要这样做,以防其他人遇到相同的问题.

I've just hacked up an extremely simple Python script to do this, in case anyone else has the same issue.

推荐答案

Pandoc的Markdown语法对于脚注非常灵活:

Pandoc's Markdown syntax is quite flexible about footnotes:

脚注本身不必放在文档末尾.它们可能会出现在除其他块元素(列表,块引号,表等)内部之外的任何位置.

The footnotes themselves need not be placed at the end of the document. They may appear anywhere except inside other block elements (lists, block quotes, tables, etc.).

赞:

Here is a footnote reference[^1] and some more text.

[^1]: Here is the footnote.

Here's the next paragraph.

但是,Markdown Writer(生成markdown文件的模块,而不是读取它们的模块)目前仅

However, the Markdown Writer (the module that generates markdown files, as opposed to reading them) currently simply places all of them at the end of the document. But this could be implemented behind a flag, similar to the --reference-links flag. Feel free to submit an issue or pull request!

这篇关于在Pandoc Markdown输出中生成内联而不是列表样式的脚注?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆