Fork me on GitHub

I am creating a new theme for Cryogen, taking the cryogen/cryogen-docs repository as an example. From the markdown content, I would like to generate heading tags with specific classes from a CSS framework included in the template ( Headings are currently generated with an Id

<h3 id="id-from-title-name">
Would it be easy to configure cryogen to generate the following instead from the markdown
<h3 id="id-from-title-name" class="title is-4 is-spaced bd-anchor-title">
There are a number of style classed I would like to apply to different html tags, so curious to know if configuring cryogen is more effective than lots of css wrangling to get the desired output? Or is there a way to use the templates to define specific default classes for specific tags? Thank you.

Jakub Holý (HolyJak)17:10:12

I'm afraid there is no out of the box solution. The only thing I can think of is postprocess-article-html-fn, see You might want to make a fork of the Markdown plugin??? Because that's is the one producing the html...

Jakub Holý (HolyJak)17:10:22

It supports "Custom node rendering API with ability to invoke standard rendering for an overridden node, allowing custom node renders that only handle special cases and let the rest be rendered as usual." it seems...


This is really useful, thanks. Do you know if it Is any easier if I switch to asciidoc instead of markdown?

Jakub Holý (HolyJak)18:10:01

It seems asciidoctor supports custom templates, I guess that works help, see Personally I think asciidoctor is thousand times better that md for writing about code. Ymmv More about asciidoctor templates and link to examples > Asciidoctor will use the templates in this directory instead of its built-in templates for any elements for which it finds a matching template.


Yes, Asciidoc looks much more suitable. I am not sure if I understand the templates. They seem a very different syntac to Custom coverters, which seem a lot clearer way of overriding the built-in html5 converter output This comment I can over-ride the built-in converters for html5 and create my own custom html output, which sounds ideal.

class Html5ConverterBulma < (Asciidoctor::Converter.for 'html5')
 register_for 'html5'
  def convert_paragraph h3
  %(<h3 id="TODO:how-to-create-an-id" class="title is-4 is-spaced bd-anchor-title" basic-navbar="">
    <span class="bd-anchor-name">#{h3.content}</span>
      <a class="bd-anchor-link" href="#basic-navbar">#</a></h3>)
If so, then I wonder if customer converters would work with cryogen? Would Cryogen be able to pick up custom converters written in Ruby (via the Asciidoc Gem pulled in by AsciidocJ)?

Jakub Holý (HolyJak)14:10:16

No idea. Regarding the templates - I would ask where the built in ones and how to write custom ones if it is unclear. Perhaps they could improve the docs....

👍 1

Hmm, there is a nice asciidoc mode in Emacs (Spacemacs) so thats an added bonus 🙂 I will continue to investigate, as a few custom converters are the missing piece I need to create an interactive and responsive website for my books with Cryogen The books will look similar to the website (with different content of course)