Markdown 将数据滚动属性添加到Kramdown脚注
有没有一种简单的方法可以将Markdown 将数据滚动属性添加到Kramdown脚注,markdown,jekyll,kramdown,Markdown,Jekyll,Kramdown,有没有一种简单的方法可以将data scroll属性添加到kramdown脚注中 [Battlezone](www.github.com) [^1] 我上面的脚注是这样的: <sup id="fnref:1"><a href="#fn:1" class="footnote">1</a></sup> 是否可以将数据滚动属性添加到锚定标记?您可以将属性添加到脚注定义中的各个脚注 This is some text with a footnote
data scroll
属性添加到kramdown脚注中
[Battlezone](www.github.com) [^1]
我上面的脚注是这样的:
<sup id="fnref:1"><a href="#fn:1" class="footnote">1</a></sup>
是否可以将
数据滚动
属性添加到锚定标记?您可以将属性添加到脚注定义中的各个脚注
This is some text with a footnote.[^note]
[^note]:{: .class #id other-attribute="attribute"}
This footnote has some attributes.
输出:
<p>This is some text with a footnote.<sup id="fnref:note"><a href="#fn:note" class="footnote">1</a></sup></p>
<div class="footnotes">
<ol>
<li id="fn:note">
<p class="class" id="id" other-attribute="attribute">This footnote has some attributes. <a href="#fnref:note" class="reversefootnote">↩</a></p>
</li>
</ol>
</div>
这是一些带有脚注的文本
[Battlezone](www.github.com) [^1]
此脚注具有一些属性
我不确定您实际上想要在数据滚动
属性中写什么。但这里有一个示例JS,它将这些属性添加到这些链接中。将此代码放在结束标记之前
您需要的是获取每个脚注链接(仅返回到内容的链接),然后向所有这些链接添加属性。可以这样做:
仅限JS
如果要将数据滚动
值设置为一个值(例如,全部设置为“true”
),代码会变得更简单:
// JS only
var footnoteLinks = document.getElementsByClassName("reversefootnote");
var i;
for (i = 0; i < footnoteLinks.length; i++) {
footnoteLinks[i].setAttribute("data-scroll", "true");
}
// jQuery
$('.reversefootnote').each(function(){
footNoteLink.attr("data-scroll", "true");
});
//仅限JS
var footnoteLinks=document.getElementsByClassName(“reversefootnote”);
var i;
对于(i=0;i
如果这不是您想要的,那么这肯定会给您一个提示。我希望能够为脚注按钮添加一个属性,而不是实际的脚注。这不可能吗?不幸的是,我不知道怎么做。您可以使用.reversefootnote类修改CSS中的所有脚注按钮,但就我所知,您需要使用sed之类的工具进行一些后期处理。
// JS only
var footnoteLinks = document.getElementsByClassName("reversefootnote");
var i;
for (i = 0; i < footnoteLinks.length; i++) {
footnoteLinks[i].setAttribute("data-scroll", "true");
}
// jQuery
$('.reversefootnote').each(function(){
footNoteLink.attr("data-scroll", "true");
});