我使用Maruku作为HAML中的一个向下标记过滤器,它会在每个标头上创建大量无用的(对我来说) it。
所以如果我有这样的东西
## This is a header它会让你
<h2 id="this_is_a_header">This is a header</h2>这在某一时刻开始变得荒谬,并用一堆我不需要也不想要的ID填充我的HTML,因为Maruku为我提供了一种提供我自己的ID的方法,
## {#id} This is a header有什么方法可以阻止它的行为吗?
发布于 2013-10-24 13:53:26
而你应该考虑切换到Maruku is obsolete (现在是麻省理工学院许可的)。
kramdown允许你switch off auto-generation of header IDs like so
puts Kramdown::Document.new("# Header with spaces #", :auto_ids => false).to_html同样在kramdown中,如果你想在头上使用set your own ID attribute,你可以做以下事情:
raw_text = "# Header with spaces #
{: #pumice-stone}"
puts Kramdown::Document.new(raw_text, :auto_ids => false).to_html输出:
<h1 id="pumice-stone">Header with spaces</h1>请记住,自定义属性({: #pumice-stone})紧跟在您希望将其应用到的块级元素下面的行上。
https://stackoverflow.com/questions/12538633
复制相似问题