forked from openid/ruby-openid
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.yard_gfm_support.rb
More file actions
22 lines (20 loc) · 895 Bytes
/
.yard_gfm_support.rb
File metadata and controls
22 lines (20 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Gratefully and liberally taken from the MIT-licensed https://github.com/bensheldon/good_job/pull/113/files
require "kramdown"
require "kramdown-parser-gfm"
# Custom markup provider class that always renders Kramdown using GFM (Github Flavored Markdown).
# GFM is needed to render markdown tables and fenced code blocks in the README.
class KramdownGfmDocument < Kramdown::Document
def initialize(source, options = {})
options[:input] = "GFM" unless options.key?(:input)
super(source, options)
end
end
# Insert the new provider as the highest priority option for Markdown.
# See:
# - https://github.com/lsegal/yard/issues/1157
# - https://github.com/lsegal/yard/issues/1017
# - https://github.com/lsegal/yard/blob/main/lib/yard/templates/helpers/markup_helper.rb
YARD::Templates::Helpers::MarkupHelper::MARKUP_PROVIDERS[:markdown].insert(
0,
{const: "KramdownGfmDocument"},
)