Skip to content

Commit

Permalink
Merge pull request #59 from gjtorikian/on-second-thought
Browse files Browse the repository at this point in the history
Add commonmarker by default
  • Loading branch information
gjtorikian committed Jul 5, 2018
2 parents 8fd432d + 3bdf755 commit 40c7447
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# frozen_string_literal: true
source 'https://rubygems.org'

gem 'commonmarker', '~> 0.16', require: false
gem 'rubocop', require: false

# Specify your gem's dependencies in graphql-docs.gemspec
gemspec
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ In your ERB layouts, there are several helper methods you can use. The helper me

To call these methods within templates, you must use the dot notation, such as `<%= slugify.(text) %>`.

For `markdownify`, `CommonMarker` is not enabled by default (because it relies on native code). You will need to add `require 'commonmarker'` if you wish to use it.

## Configuration

The following options are available:
Expand Down
2 changes: 2 additions & 0 deletions graphql-docs.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'graphql', '~> 1.6'

# rendering
spec.add_dependency 'commonmarker', '~> 0.16'
spec.add_dependency 'html-pipeline', '~> 2.8'
spec.add_dependency 'escape_utils', '~> 1.2'
spec.add_dependency 'extended-markdown-filter', '~> 0.4'
Expand All @@ -37,6 +38,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'minitest-focus', '~> 1.1'
spec.add_development_dependency 'pry-byebug', '~> 3.6'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rubocop-github'
spec.add_development_dependency 'webmock', '~> 2.3'
end
4 changes: 3 additions & 1 deletion lib/graphql-docs/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# frozen_string_literal: true

require 'commonmarker'

module GraphQLDocs
module Helpers
SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze
Expand All @@ -19,7 +22,6 @@ def include(filename, opts = {})

def markdownify(string)
return '' if string.nil?
return string unless defined?(CommonMarker)
::CommonMarker.render_html(string, :DEFAULT).strip
end

Expand Down

0 comments on commit 40c7447

Please sign in to comment.