Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have YARD render markdown files with GFM (Github Flavored Markdown) #113

Merged
merged 1 commit into from
Aug 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .yard_support.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,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' }
)
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--load .yard_support.rb
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ DEPENDENCIES
gem-release
github_changelog_generator
good_job!
kramdown
kramdown-parser-gfm
mdl
pry-rails
puma
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GoodJob is a multithreaded, Postgres-based, ActiveJob backend for Ruby on Rails.

For more of the story of GoodJob, read the [introductory blog post](https://island94.org/2020/07/introducing-goodjob-1-0).

<details>
<details markdown="1">
<summary><strong>📊 Comparison of GoodJob with other job queue backends (click to expand)</strong></summary>

| | Queues, priority, retries | Database | Concurrency | Reliability/Integrity | Latency |
Expand Down
2 changes: 2 additions & 0 deletions good_job.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "foreman"
spec.add_development_dependency "gem-release"
spec.add_development_dependency "github_changelog_generator"
spec.add_development_dependency "kramdown"
spec.add_development_dependency "kramdown-parser-gfm"
spec.add_development_dependency "mdl"
spec.add_development_dependency "pry-rails"
spec.add_development_dependency "puma"
Expand Down