forked from bensheldon/good_job
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.yard_support.rb
More file actions
21 lines (19 loc) · 787 Bytes
/
.yard_support.rb
File metadata and controls
21 lines (19 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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' }
)