Skip to content

Instantly share code, notes, and snippets.

@ankitrgadiya
Created March 12, 2022 23:50
Show Gist options
  • Save ankitrgadiya/180481c87d5839e4968748194f46817f to your computer and use it in GitHub Desktop.
Save ankitrgadiya/180481c87d5839e4968748194f46817f to your computer and use it in GitHub Desktop.
Gollum Configuration
require 'commonmarker'
module Gollum
class Markup
mmd = proc { |content|
MultiMarkdown.new(content).to_html
}
GitHub::Markup::Markdown::MARKDOWN_GEMS['commonmarker'] = proc { |content, options: {}|
commonmarker_opts = [:GITHUB_PRE_LANG].concat(options.fetch(:commonmarker_opts, []))
commonmarker_exts = options.fetch(:commonmarker_exts, [:tagfilter, :autolink, :table, :strikethrough, :tasklist])
CommonMarker.render_html(content, commonmarker_opts, commonmarker_exts)
}
GitHub::Markup::Markdown::MARKDOWN_GEMS.delete('kramdown')
end
end
wiki_options = {
:allow_uploads => true,
:critic_markup => true,
:emoji => true,
:hyphened_tag_lookup => true,
:case_insensitive_tag_lookup => true,
:global_tag_lookup => true,
:show_all => true,
}
Precious::App.set(:wiki_options, wiki_options)
Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
Gollum::Page::FORMAT_NAMES = { :markdown => "Markdown" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment