markdown插入参考文献

主要内容

本文主要针对如何在博客的markdown写作中插入参考文献进行了分析和讨论

几个参考文章:
https://chalkit.tk/20171202-convert-markdown-inline-link-to-reference-footnote/
https://liuyun16.github.io/tools/2018-2-24-atom-markdown-zotero/

1[^footnote]

目标

预期目标是:

  • 在markdown写作中运用一种插入文献的方法,使得生成的博客能够显示出参考文献
    • 写作基于markdown,部署使用hexo,最终生成的是html
  • 参考文献应像latex的参考文献一样,具有动态更新的特性,即
    • 参考文献在文章中的插入地方 应与 最后的参考文献列表 具有关键词的对应关系

现有的几种方法

  1. 链接插入,参见第一篇文章,只能插入链接

    1
    2
    3
    4
    5
    This is [an example][id] reference-style link.

    Then, anywhere in the document, you define your link label like this, on a line by itself:

    [id]: http://example.com/ "Optional Title Here"
  2. 脚注插入

    1
    2
    3
    You can create footnotes like this[^footnote].

    [^footnote]: Here is the *text* of the **footnote**.

存在问题:网站上显示时,会显示源代码而不是对应的格式,可以参考第一篇文章的方法解决。

  1. pandoc+bib
    具体用法参考第二篇文章,但是并不适用与当前环境,因为使用pandoc是直接将md转换为docx,而在博客条件下我们是需要提供md让hexo帮我们生成html,所以这里暂时不讨论

最终选择的方法

最终选择用脚注的方式插入

改进设想

建立bib文件存储参考文献的信息,在原文中直接\cite{xxx},然后编写一个Python文件将其替换为相应的标号和格式。

[^footnote]: a foot note