mirror of
https://github.com/olivierlacan/keep-a-changelog.git
synced 2025-07-31 01:34:18 +02:00
Set TOC data for Markdown & override Haml filter
This commit is contained in:
parent
76d8c70889
commit
7adec560c8
22
config.rb
22
config.rb
@ -55,12 +55,14 @@ activate :automatic_image_sizes
|
||||
|
||||
activate :syntax
|
||||
set :markdown_engine, :redcarpet
|
||||
set :markdown, {
|
||||
$markdown_config = {
|
||||
fenced_code_blocks: true,
|
||||
footnotes: true,
|
||||
smartypants: true,
|
||||
tables: true
|
||||
tables: true,
|
||||
with_toc_data: true
|
||||
}
|
||||
set :markdown, $markdown_config
|
||||
|
||||
# --------------------------------------
|
||||
# Helpers
|
||||
@ -117,3 +119,19 @@ activate :autoprefixer do |config|
|
||||
config.browsers = ['last 2 versions', 'Explorer >= 10']
|
||||
config.cascade = false
|
||||
end
|
||||
|
||||
# Haml doesn't pick up on Markdown configuration so we have to remove the
|
||||
# default Markdown Haml filter and reconfigure one that follows our
|
||||
# global configuration.
|
||||
|
||||
module Haml::Filters
|
||||
remove_filter("Markdown") #remove the existing Markdown filter
|
||||
|
||||
module Markdown
|
||||
include Haml::Filters::Base
|
||||
|
||||
def render(text)
|
||||
Redcarpet::Markdown.new(Redcarpet::Render::HTML.new($markdown_config)).render(text)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user