Class: JekyllCommonMarkCustomRenderer
- Inherits:
-
CommonMarker::HtmlRenderer
- Object
- CommonMarker::HtmlRenderer
- JekyllCommonMarkCustomRenderer
- Defined in:
- lib/jekyll-commonmark-ghpages.rb
Overview
A customized version of CommonMarker::HtmlRenderer which outputs Kramdown-style header IDs.
Instance Method Summary collapse
Instance Method Details
#header(node) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/jekyll-commonmark-ghpages.rb', line 11 def header(node) block do old_stream = @stream @stream = StringIO.new(String.new.force_encoding("utf-8")) out(:children) content = @stream.string @stream = old_stream id = generate_id(content) out("<h", node.header_level, "#{sourcepos(node)} id=\"#{id}\">", content, "</h", node.header_level, ">") end end |