Re: Custom style on title/heading element?

Posted by thoraxe on
URL: https://discuss.asciidoctor.org/Solved-Custom-style-on-title-heading-element-tp4543p4547.html

OK, sorry to post a response to my own response, but after digging a little deeper I'm pretty confident I'm going to need to use a template. But I am using asciidoctor with Middleman, so I'm not sure where the templates need to go.

I'm working on incorporating the following theme with Middleman/Asciidoc so that contributors don't have to write ERB:

http://themes.vsart.me/vsdocs/tutorial.html

In some cases, I need a heading with a fragment identifier (anchor-y stuff):

<div class="category-info helper pt0" id="tutorial">
  <h3 class="category-title">
    Short Photoshop tutorial
    <a class="fragment-identifier js-fragment-identifier fragment-identifier-scroll" href="#tutorial">
      <i class="fa fa-link"></i>
    </a>
  </h3>
</div>

Here's the slim you referenced, which I assume is the "out of the box" template:

- sect0 = section_level == 0
= html_tag_if !sect0, :div, class: [%(sect#{section_level}), role]
  *{tag: %(h#{section_level + 1}), id: id, class: ('sect0' if sect0)}
    - if id && (document.attr? :sectanchors)
      a.anchor href="##{id}"
      =section_title
    - elsif id && (document.attr? :sectlinks)
      a.link href="##{id}" =section_title
    - else
      =section_title
  - if section_level == 1
    .sectionbody =content
  - else
    =content

So, I'm guessing I'll need to engineer a template that somehow gets passed an attribute "anchored" which inserts the fragment identifier bit... which is where I'm a little lost.

I'm not asking you to write the template for me, just trying to figure out (when using Middleman) where the Asciidoctor template needs to go and/or how to specify how to use it and/or where the docs are on passing attributes (not necessarily CSS) to the template/item.

After that I've got some fussing to do with the UL and other templates, but that shouldn't be too bad.