yard-commonmarker 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ded622df60a2b58f502b073ef15fc72cdcc28f6d
4
+ data.tar.gz: 9ef7595b4f35e01177a55108d6648d0ca4e84d1f
5
+ SHA512:
6
+ metadata.gz: c89aa2c746bdf0d9d49a64795e7865f84a01c474630b2495f0763bd0fa54ea9826f0733a0e5ab4243dc5e9d6252d6acfdc964c8c917d2868bd46c360e856b311
7
+ data.tar.gz: 939f76ed2a81ac73e2f2d19053ef0e3504ea20a0e9b1530d9e9415b505aa6ab6114821e68f6b3855a47483de8e8c22beca48c9a3cdb015990a1b1aa7d8c98159
data/.editorconfig ADDED
@@ -0,0 +1,7 @@
1
+ [*]
2
+ charset=utf-8
3
+ end_of_line=lf
4
+ trim_trailing_whitespace=true
5
+ insert_final_newline=true
6
+ indent_style=space
7
+ indent_size=2
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.ruby-version
3
+ /.yardoc
4
+ /_yardoc/
5
+ /bundle/
6
+ /coverage/
7
+ /doc/
8
+ /Gemfile.lock
9
+ /pkg/
10
+ /spec/reports/
11
+ /tmp/
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,90 @@
1
+ # See documentation at https://docs.gitlab.com/ee/ci/yaml/README.html
2
+ variables:
3
+ CI_REGISTRY_IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
4
+ CI_REGISTRY_IMAGE_STABLE: $CI_REGISTRY_IMAGE:stable
5
+
6
+ stages:
7
+ - test
8
+ - deploy
9
+
10
+ .docker_build: &docker
11
+ image: docker:latest
12
+ services:
13
+ - docker:dind
14
+ before_script:
15
+ - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
16
+
17
+ .ruby_build: &ruby
18
+ image: $CI_REGISTRY_IMAGE_LATEST
19
+ # Cache gems in between builds
20
+ cache:
21
+ paths:
22
+ - /cache
23
+ # This is a basic example for a gem or script which doesn't use
24
+ # services such as redis or postgres
25
+ before_script:
26
+ - ruby -v # Print out ruby version for debugging
27
+ - gem install bundler --no-ri --no-rdoc # Bundler is not installed with the image
28
+ - bundle install -j $(nproc) --path=".bundle" # Install dependencies into ./.bundle
29
+
30
+ .release_docker_image: &release_docker_image
31
+ <<: *docker
32
+ stage: deploy
33
+ script:
34
+ - echo "Releasing ${$TARGET_IMAGE} from $CI_REGISTRY_IMAGE_LATEST"
35
+ - docker pull $CI_REGISTRY_IMAGE_LATEST
36
+ - docker tag $CI_REGISTRY_IMAGE_LATEST ${$TARGET_IMAGE}
37
+ - docker push ${$TARGET_IMAGE}
38
+
39
+ test:
40
+ <<: *ruby
41
+ script: bin/rake test
42
+ stage: test
43
+ artifacts:
44
+ paths:
45
+ - Gemfile.lock
46
+ - spec/reports
47
+ - coverage
48
+
49
+ doc:
50
+ <<: *ruby
51
+ script: bin/rake doc
52
+ stage: test
53
+ artifacts:
54
+ paths:
55
+ - doc
56
+
57
+ build latest docker:
58
+ <<: *docker
59
+ stage: deploy
60
+ only:
61
+ - develop
62
+ dependencies:
63
+ - test
64
+ script:
65
+ - echo "Building $CI_REGISTRY_IMAGE_LATEST"
66
+ - docker build --pull -t $CI_REGISTRY_IMAGE_LATEST .
67
+ - docker push $CI_REGISTRY_IMAGE_LATEST
68
+
69
+ build stable docker:
70
+ <<: *docker
71
+ stage: deploy
72
+ only:
73
+ - master
74
+ dependencies:
75
+ - test
76
+ script:
77
+ - echo "Building $CI_REGISTRY_IMAGE_STABLE"
78
+ - docker build --pull -t $CI_REGISTRY_IMAGE_STABLE .
79
+ - docker push $CI_REGISTRY_IMAGE_STABLE
80
+
81
+ build_gem:
82
+ <<: *ruby
83
+ script: bin/rake build
84
+ only:
85
+ - develop
86
+ stage: deploy
87
+ artifacts:
88
+ paths:
89
+ - doc
90
+ - pkg
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,20 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ DefaultFormatter: fuubar
4
+ DisplayCopNames: true
5
+ ExtraDetails: true
6
+ Exclude:
7
+ # Ignore vendored gems
8
+ - vendor/**/*
9
+ - bundle/**/*
10
+
11
+ # It is 2017-01-01 (atm), use UTF-8 FTW!
12
+ Style/AsciiComments:
13
+ Enabled: false
14
+
15
+ # Ignore convenient files that helps load
16
+ Style/FileName:
17
+ Exclude:
18
+ - 'lib/yard-commonmarker.rb'
19
+
20
+ inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,15 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2017-05-11 05:22:37 +0300 using RuboCop version 0.48.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
12
+ # SupportedStyles: final_newline, final_blank_line
13
+ Style/TrailingBlankLines:
14
+ Exclude:
15
+ - 'lib/yard/templates/helpers/markup_helper/commonmarker.rb'
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.13.7
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --title 'YARD CommonMarker'
2
+ --plugin yard-commonmarker
3
+ --markup-provider commonmarker
4
+ --markup commonmark
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at alex@semyonov.us. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Dockerfile ADDED
@@ -0,0 +1,21 @@
1
+ FROM ruby:2.4-alpine
2
+
3
+ RUN apk --update --upgrade add --no-cache \
4
+ build-base \
5
+ cmake \
6
+ coreutils \
7
+ git
8
+
9
+ RUN mkdir /app
10
+ WORKDIR /app
11
+
12
+ RUN gem install bundler --no-ri --no-rdoc
13
+
14
+ ADD lib/yard/commonmarker/version.rb /app/lib/yard/commonmarker/version.rb
15
+ ADD yard-commonmarker.gemspec /app/yard-commonmarker.gemspec
16
+ ADD Gemfile /app/Gemfile
17
+ ADD Gemfile.lock /app/Gemfile.lock
18
+
19
+ RUN bundle install
20
+
21
+ ADD . /app
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in yard-commonmarker.gemspec
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ © Alex Semyonov, 2017
2
+
3
+ The MIT License (MIT)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # yard-commonmarker
2
+
3
+ Use [CommonMarker][] for ~[Markdown][]~ [CommonMark][] text markup.
4
+
5
+ _Note_: [Markdown][] markup support simulated by using [CommonMark][] instead.
6
+
7
+ ## Installation
8
+
9
+ * _For existing code_:
10
+
11
+ 1. Declare a dependency:
12
+ * _developing a gem_:
13
+
14
+ Add this line to your gemspec:
15
+
16
+ ```ruby
17
+ spec.add_development_dependency 'yard-commonmarker'
18
+ ```
19
+
20
+ * _developing an app_:
21
+
22
+ Add this line to your application's Gemfile (in `development` group):
23
+
24
+ ```ruby
25
+ gem 'yard-commonmarker'
26
+ ```
27
+ 1. And then execute:
28
+
29
+ ```bash
30
+ bundle
31
+ ```
32
+
33
+ To install required dependencies.
34
+
35
+ * _Or install it yourself if you have no code yet_:
36
+
37
+ ```bash
38
+ gem install yard-commonmarker
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ Put following lines into `.yardopts` file:
44
+
45
+ ```
46
+ --plugin yard-commonmarker
47
+ --markup-provider commonmarker
48
+ --markup commonmark
49
+ ```
50
+
51
+ or
52
+
53
+
54
+ ```
55
+ --plugin yard-commonmarker
56
+ --markup-provider commonmarker
57
+ --markup markdown
58
+ ```
59
+
60
+ ## Development
61
+
62
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
63
+
64
+ To install this gem onto your local machine, run `bin/rake install`. To release a new version, update the version number in `lib/yard/commonmarker/version.rb`, and then run `bin/rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
65
+
66
+ ## Contributing
67
+
68
+ Bug reports and pull requests are welcome [on GitLab][yard-commonmarker]. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
69
+
70
+ © Alex Semyonov, 2017, [MIT License](http://opensource.org/licenses/MIT)
71
+
72
+ [CommonMarker]: https://github.com/gjtorikian/commonmarker "commonmarker gem"
73
+ [CommonMark]: http://commonmark.org/ "CommonMark. A strongly defined, highly compatible specification of Markdown"
74
+ [Markdown]: http://daringfireball.net/projects/markdown/syntax "Markdown: Syntax"
75
+ [YARD]: http://yardoc.org/ "YARD — A Ruby Documentation Tool"
76
+ [yard-commonmarker]: https://gitlab.com/alsemyonov/yard-commonmarker
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'development/tasks'
4
+ Development::Tasks.install
5
+
6
+ task release: %i[test doc]
data/bin/bundler ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundler' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('bundler', 'bundler')
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'yard/commonmarker'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start
data/bin/htmldiff ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'htmldiff' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('diff-lcs', 'htmldiff')
data/bin/ldiff ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'ldiff' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('diff-lcs', 'ldiff')
data/bin/rake ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('rake', 'rake')
data/bin/rspec ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('rspec-core', 'rspec')
data/bin/rubocop ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('rubocop', 'rubocop')
data/bin/ruby-parse ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'ruby-parse' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('parser', 'ruby-parse')
data/bin/ruby-rewrite ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'ruby-rewrite' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('parser', 'ruby-rewrite')
data/bin/setup ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+ bin/rubocop --auto-correct
8
+
9
+ # Do any other automated setup that you need to do here
data/bin/yard ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'yard' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('yard', 'yard')
data/bin/yardoc ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'yardoc' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('yard', 'yardoc')
data/bin/yri ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'yri' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('yard', 'yri')
@@ -0,0 +1,4 @@
1
+ version: '2'
2
+ services:
3
+ yard-commonmarker:
4
+ image: registry.gitlab.com/alsemyonov/yard-commonmarker:latest
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'commonmarker/compat_renderer'
4
+
5
+ Markdown = CommonMarker::CompatRenderer unless defined? Markdown
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'commonmarker'
4
+
5
+ module CommonMarker
6
+ # Compatibility with the RedCloth API.
7
+ # @see https://github.com/vmg/redcarpet/blob/master/lib/redcarpet/compat.rb#L1
8
+ class CompatRenderer
9
+ attr_accessor :text
10
+
11
+ GITHUB_EXTENSIONS = %i[tagfilter autolink table strikethrough].freeze
12
+
13
+ def initialize(text, exts = GITHUB_EXTENSIONS, options: :GITHUB_PRE_LANG)
14
+ @text = text
15
+ @extensions = GITHUB_EXTENSIONS | exts
16
+ @options = options
17
+ end
18
+
19
+ def to_html(*_dummy)
20
+ CommonMarker.render_html(text, options, extensions)
21
+ end
22
+
23
+ private
24
+
25
+ # @return [String]
26
+ attr_reader :text
27
+
28
+ # @return [Symbol]
29
+ attr_reader :options
30
+
31
+ # @return [<Symbol>]
32
+ attr_reader :extensions
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yard/templates/helpers/markup_helper/commonmarker'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YARD
4
+ module CommonMarker
5
+ VERSION = '0.3.0'
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yard'
4
+ require 'yard/templates/helpers/markup_helper'
5
+ require 'commonmarker/compat_renderer'
6
+
7
+ # @see https://github.com/lsegal/yard/blob/master/lib/yard/templates/helpers/markup_helper.rb#L26
8
+ YARD::Templates::Helpers::MarkupHelper::MARKUP_PROVIDERS[:markdown] <<
9
+ { lib: :commonmarker, const: 'CommonMarker::CompatRenderer' }
10
+ YARD::Templates::Helpers::MarkupHelper::MARKUP_PROVIDERS[:commonmark] =
11
+ [{ lib: :commonmarker, const: 'CommonMarker::CompatRenderer' }]
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ lib = File.expand_path('../lib', __FILE__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require 'yard/commonmarker/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'yard-commonmarker'
10
+ spec.version = YARD::CommonMarker::VERSION
11
+ spec.authors = ['Alex Semyonov']
12
+ spec.email = ['alex@semyonov.us']
13
+
14
+ spec.summary = 'CommonMarker support for YARD'
15
+ spec.description = 'CommonMark and Markdown markup provider for YARD'
16
+ spec.homepage = 'https://alsemyonov.gitlab.com/yard-commonmarker/'
17
+ spec.license = 'MIT'
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ f.match(%r{^(test|spec|features)/})
21
+ end
22
+ spec.bindir = 'exe'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.add_runtime_dependency 'commonmarker', '~> 0.16'
27
+ spec.add_runtime_dependency 'yard', '~> 0.9'
28
+
29
+ spec.add_development_dependency 'development-toolbox', '~> 0.4'
30
+ end
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yard-commonmarker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Semyonov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-05-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: commonmarker
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.16'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: yard
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.9'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.9'
41
+ - !ruby/object:Gem::Dependency
42
+ name: development-toolbox
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.4'
55
+ description: CommonMark and Markdown markup provider for YARD
56
+ email:
57
+ - alex@semyonov.us
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".editorconfig"
63
+ - ".gitignore"
64
+ - ".gitlab-ci.yml"
65
+ - ".rspec"
66
+ - ".rubocop.yml"
67
+ - ".rubocop_todo.yml"
68
+ - ".travis.yml"
69
+ - ".yardopts"
70
+ - CODE_OF_CONDUCT.md
71
+ - Dockerfile
72
+ - Gemfile
73
+ - LICENSE
74
+ - README.md
75
+ - Rakefile
76
+ - bin/bundler
77
+ - bin/console
78
+ - bin/htmldiff
79
+ - bin/ldiff
80
+ - bin/rake
81
+ - bin/rspec
82
+ - bin/rubocop
83
+ - bin/ruby-parse
84
+ - bin/ruby-rewrite
85
+ - bin/setup
86
+ - bin/yard
87
+ - bin/yardoc
88
+ - bin/yri
89
+ - docker-compose.yml
90
+ - lib/commonmarker/compat.rb
91
+ - lib/commonmarker/compat_renderer.rb
92
+ - lib/yard-commonmarker.rb
93
+ - lib/yard/commonmarker/version.rb
94
+ - lib/yard/templates/helpers/markup_helper/commonmarker.rb
95
+ - yard-commonmarker.gemspec
96
+ homepage: https://alsemyonov.gitlab.com/yard-commonmarker/
97
+ licenses:
98
+ - MIT
99
+ metadata: {}
100
+ post_install_message:
101
+ rdoc_options: []
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubyforge_project:
116
+ rubygems_version: 2.6.11
117
+ signing_key:
118
+ specification_version: 4
119
+ summary: CommonMarker support for YARD
120
+ test_files: []