How can I more effectively insert footnotes in a Hexo message?

I am trying to insert footnotes in my Hexo posts (written in Markdown if their markup language matters). I proceed from the experience of using Jekyll to power my sites, and when I used Jekyll, I would add [^n](where n is a positive integer, i.e. N & isin; {1,2,3, ...}) in the text and something like:

[^1]: footnote #1
[^2]: footnote #2
[^3]: footnote #3
...

at the end of the message, where footnote #1, #2, #3and etc. replaced by my actual footnotes. Although with Hexo things seem a little more complicated. I searched for the footnote plugin at https://hexo.io/plugins/ , I can unsuccessfully add, then I used Google to find the answer and found this gist https://gist.github.com/kuanyui/d1728c2a526a615de56c . I tried to use this method by adding it to my Hexo folder script, but it didn’t succeed (see the bottom line for complete error information, as I commented on the details there). Then I tried the HTML trick I learned by examining the generated content of my Jekyll posts in which footnotes were added using the above method. Namely, by adding:

<sup id="fnref:n"><a href="#fn:n" class="footnote">n</a></sup>

( n - ) , , :

<ol>
  <li id="fn:1">Footnote #1.<a href="#fnref:1" class="reversefootnote"></a></li>
  <li id="fn:2">Footnote #2.<a href="#fnref:2" class="reversefootnote"></a></li>
  <li id="fn:3">Footnote #3.<a href="#fnref:3" class="reversefootnote"></a></li>
  ...
</ol>

. , , , (.. , ), ejs ( ), layouts footnotes.ejs:

<sup id ="fnref:<%= n %>"><a href="#fn:<%= n %>"><%= n %></a></sup>

:

<%- include('layouts/footnotes', {n:1}); %>

( , , ​​ ).

, , Hexo. , .

+4
1

:

,

npm install hexo-footnotes --save

Hexo , .

, _config.yml:

plugins:
  - hexo-footnotes

:

basic footnote[^1]
here is an inline footnote[^2](inline footnote)
and another one[^3]
and another one[^4]

[^1]: basic footnote content
[^3]: paragraph
footnote
content
[^4]: footnote content with some [markdown](https://en.wikipedia.org/wiki/Markdown)

:

footnotes

+5

All Articles