rtitle.rb 644 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module Jekyll
    module Tags
      class RtitleTag < Liquid::Block
        def initialize(tag_name, block_options, liquid_options)
            super
            @title = block_options.strip
        end
  
        def render(context)
            site = context.registers[:site]
            converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
            content = converter.convert(super)
            output = <<~EOS
<div class="rtitle">
<h2>#{@title}</h2>
<hr>
    #{content}
</div>
    EOS
        
            output
        end
      end
    end
  end
  
Liquid::Template.register_tag('rtitle', Jekyll::Tags::RtitleTag)