jekyll-commonmark-1.3.1/0000755000004100000410000000000013514203551015176 5ustar www-datawww-datajekyll-commonmark-1.3.1/jekyll-commonmark.gemspec0000644000004100000410000000207513514203551022202 0ustar www-datawww-data# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("lib", __dir__) require "jekyll-commonmark/version" Gem::Specification.new do |spec| spec.name = "jekyll-commonmark" spec.summary = "CommonMark generator for Jekyll" spec.version = Jekyll::CommonMark::VERSION spec.authors = ["Pat Hawks"] spec.email = "pat@pathawks.com" spec.homepage = "https://github.com/pathawks/jekyll-commonmark" spec.licenses = ["MIT"] spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r!^bin/!) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r!^(test|spec|features)/!) spec.require_paths = ["lib"] spec.required_ruby_version = ">= 2.3.0" spec.add_runtime_dependency "commonmarker", "~> 0.14" spec.add_runtime_dependency "jekyll", ">= 3.7", "< 5.0" spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 12.0" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "rubocop-jekyll", "~> 0.5" end jekyll-commonmark-1.3.1/.travis.yml0000644000004100000410000000114213514203551017305 0ustar www-datawww-datalanguage: ruby cache: bundler rvm: - &latest_ruby 2.6 - 2.4 - 2.3 git: depth: 3 # we need a more recent cmake than travis/linux provides (at least 2.8.9): addons: apt: sources: - kalakris-cmake packages: - cmake before_install: - gem update --system - gem install bundler before_script: bundle update script: script/cibuild env: global: - NOKOGIRI_USE_SYSTEM_LIBRARIES=true matrix: - JEKYLL_VERSION="~> 3.8" matrix: include: - rvm: *latest_ruby env: JEKYLL_VERSION="~> 3.7.4" - rvm: *latest_ruby env: JEKYLL_VERSION=">= 4.0.0.pre.alpha1" jekyll-commonmark-1.3.1/spec/0000755000004100000410000000000013514203551016130 5ustar www-datawww-datajekyll-commonmark-1.3.1/spec/jekyll_commonmark_spec.rb0000644000004100000410000000451113514203551023205 0ustar www-datawww-data# frozen_string_literal: true require "spec_helper" describe(Jekyll::Converters::Markdown::CommonMark) do let(:options) { [] } let(:extensions) { [] } let(:config) do { "commonmark" => { "options" => options, "extensions" => extensions, }, } end let(:commonmark) { described_class.new(config) } let(:output) { commonmark.convert(content) } context "with default configuration" do it "produces the correct script tag" do actual = commonmark.convert("# Heading") expected = "

Heading

" expect(actual).to match(expected) end it "does not treat newlines as hardbreaks" do actual = commonmark.convert("a\nb") expected = "

a\nb

" expect(actual).to match(expected) end it "treats double linebreaks as a new paragraph" do actual = commonmark.convert("a\n\nb") expected = "

a

\n

b

" expect(actual).to match(expected) end it "escapes quotes" do actual = commonmark.convert('"SmartyPants"') expected = "

"SmartyPants"

" expect(actual).to match(expected) end it "does not link urls" do actual = commonmark.convert("https://example.com") expected = "https://example.com" expect(actual).to match(expected) end end context "with SmartyPants enabled" do let(:options) { ["SMART"] } it "makes quotes curly" do actual = commonmark.convert('"SmartyPants"') expected = "

“SmartyPants”

" expect(actual).to match(expected) end end context "with hardbreaks enabled" do let(:options) { ["HARDBREAKS"] } it "treats newlines as hardbreaks" do actual = commonmark.convert("a\nb") expected = "

a
\nb

" expect(actual).to match(expected) end end context "with nobreaks enabled" do let(:options) { ["NOBREAKS"] } it "treats newlines as a single space" do actual = commonmark.convert("a\nb") expected = "

a b

" expect(actual).to match(expected) end end context "with autolink enabled" do let(:extensions) { ["autolink"] } it "links urls" do actual = commonmark.convert("https://example.com") expected = '

https://example.com

' expect(actual).to match(expected) end end end jekyll-commonmark-1.3.1/spec/spec_helper.rb0000644000004100000410000000040713514203551020747 0ustar www-datawww-data# frozen_string_literal: true require "jekyll" require_relative "../lib/jekyll-commonmark.rb" Jekyll.logger.log_level = :info RSpec.configure do |config| config.run_all_when_everything_filtered = true config.filter_run :focus config.order = "random" end jekyll-commonmark-1.3.1/.rubocop.yml0000644000004100000410000000027013514203551017447 0ustar www-datawww-datainherit_from: .rubocop_todo.yml require: rubocop-jekyll inherit_gem: rubocop-jekyll: .rubocop.yml AllCops: TargetRubyVersion: 2.3 Exclude: - script/**/* - vendor/**/* jekyll-commonmark-1.3.1/.gitignore0000644000004100000410000000004513514203551017165 0ustar www-datawww-data*.gem Gemfile.lock spec/dest .bundle jekyll-commonmark-1.3.1/script/0000755000004100000410000000000013514203551016502 5ustar www-datawww-datajekyll-commonmark-1.3.1/script/release0000755000004100000410000000012513514203551020046 0ustar www-datawww-data#!/bin/sh # Tag and push a release. set -e script/cibuild bundle exec rake release jekyll-commonmark-1.3.1/script/console0000755000004100000410000000131113514203551020066 0ustar www-datawww-data#! /usr/bin/env ruby # frozen_string_literal: true def relative_to_root(path) File.expand_path(path, File.dirname(File.dirname(__FILE__))) end require "jekyll" require relative_to_root("lib/jekyll-smartify.rb") require "pry-debugger" SOURCE_DIR = relative_to_root("spec/fixtures") DEST_DIR = relative_to_root("spec/dest") def source_dir(*files) File.join(SOURCE_DIR, *files) end def dest_dir(*files) File.join(DEST_DIR, *files) end def config(overrides = {}) Jekyll.configuration( "source" => source_dir, "destination" => dest_dir, "url" => "http://example.org" ).merge(overrides) end def site(configuration = config) Jekyll::Site.new(configuration) end binding.pry jekyll-commonmark-1.3.1/script/cibuild0000755000004100000410000000005313514203551020041 0ustar www-datawww-data#! /bin/bash script/fmt bundle exec rspec jekyll-commonmark-1.3.1/script/bootstrap0000755000004100000410000000003513514203551020443 0ustar www-datawww-data#! /bin/bash bundle install jekyll-commonmark-1.3.1/script/fmt0000755000004100000410000000013713514203551017217 0ustar www-datawww-data#!/bin/sh set -e echo "Rubocop $(bundle exec rubocop --version)" bundle exec rubocop -D -E $@ jekyll-commonmark-1.3.1/LICENSE0000644000004100000410000000213713514203551016206 0ustar www-datawww-dataThe MIT License (MIT) Copyright (c) 2015-present Pat Hawks and jekyll-commonmark contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jekyll-commonmark-1.3.1/.rubocop_todo.yml0000644000004100000410000000223513514203551020477 0ustar www-datawww-data# This configuration was generated by # `rubocop --auto-gen-config` # on 2019-01-03 13:58:24 +0100 using RuboCop version 0.62.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. # Offense count: 1 # Configuration parameters: Max. Metrics/AbcSize: Exclude: - 'lib/jekyll-commonmark.rb' # Offense count: 1 # Configuration parameters: CountComments, Max, ExcludedMethods. # ExcludedMethods: refine Metrics/BlockLength: Exclude: - 'spec/jekyll_commonmark_spec.rb' # Offense count: 1 # Configuration parameters: Max. Metrics/CyclomaticComplexity: Exclude: - 'lib/jekyll-commonmark.rb' # Offense count: 1 # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Metrics/LineLength: Exclude: - 'lib/jekyll-commonmark.rb' # Offense count: 1 # Configuration parameters: CountComments, Max, ExcludedMethods. Metrics/MethodLength: Exclude: - 'lib/jekyll-commonmark.rb' jekyll-commonmark-1.3.1/Readme.md0000644000004100000410000000271613514203551016723 0ustar www-datawww-data# jekyll-commonmark *CommonMark Markdown converter for Jekyll* [![Gem Version](https://img.shields.io/gem/v/jekyll-commonmark.svg)](https://rubygems.org/gems/jekyll-commonmark) [![Build Status](https://img.shields.io/travis/jekyll/jekyll-commonmark/master.svg)](https://travis-ci.org/jekyll/jekyll-commonmark) [![Windows Build status](https://img.shields.io/appveyor/ci/pathawks/jekyll-commonmark/master.svg?label=Windows%20build)](https://ci.appveyor.com/project/pathawks/jekyll-commonmark) [![Dependency Status](https://img.shields.io/gemnasium/pathawks/jekyll-commonmark.svg)](https://gemnasium.com/pathawks/jekyll-commonmark) Jekyll Markdown converter that uses [libcmark](https://github.com/jgm/CommonMark), the reference parser for CommonMark. As a result, it is faster than Kramdown. GitHub Pages supports CommonMark through https://github.com/github/jekyll-commonmark-ghpages ## Installation Add the following to your `Gemfile` ```ruby group :jekyll_plugins do gem 'jekyll-commonmark' end ``` and modify your `_config.yml` to use **CommonMark** as your Markdown converter ```yaml markdown: CommonMark ``` ## Configuration To specify [extensions](https://github.com/gjtorikian/commonmarker#extensions) and [options](https://github.com/gjtorikian/commonmarker#options) for use in converting Markdown to HTML, supply options to the Markdown converter: ```yaml commonmark: options: ["SMART", "FOOTNOTES"] extensions: ["strikethrough", "autolink", "table"] ``` jekyll-commonmark-1.3.1/Rakefile0000644000004100000410000000022413514203551016641 0ustar www-datawww-data# frozen_string_literal: true require "bundler/gem_tasks" require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) task :default => :spec jekyll-commonmark-1.3.1/lib/0000755000004100000410000000000013514203551015744 5ustar www-datawww-datajekyll-commonmark-1.3.1/lib/jekyll-commonmark.rb0000755000004100000410000000341013514203551021725 0ustar www-datawww-data# frozen-string-literal: true module Jekyll module Converters class Markdown class CommonMark def initialize(config) Jekyll::External.require_with_graceful_fail "commonmarker" begin options = config["commonmark"]["options"].collect { |e| e.upcase.to_sym } rescue NoMethodError options = [] else valid_opts = Set.new(CommonMarker::Config::Parse.keys + CommonMarker::Config::Render.keys) options.reject! do |e| next if valid_opts.include? e Jekyll.logger.warn "CommonMark:", "#{e} is not a valid option" Jekyll.logger.info "Valid options:", valid_opts.to_a.join(", ") true end end begin @extensions = config["commonmark"]["extensions"].collect(&:to_sym) rescue NoMethodError @extensions = [] else @extensions.reject! do |e| next if CommonMarker.extensions.include? e.to_s Jekyll.logger.warn "CommonMark:", "#{e} is not a valid extension" Jekyll.logger.info "Valid extensions:", CommonMarker.extensions.join(", ") true end end options_set = Set.new(options).freeze @parse_options = (options_set & CommonMarker::Config::Parse.keys).to_a @render_options = (options_set & CommonMarker::Config::Render.keys).to_a @parse_options = :DEFAULT if @parse_options.empty? @render_options = :DEFAULT if @render_options.empty? end def convert(content) CommonMarker.render_doc(content, @parse_options, @extensions) .to_html(@render_options, @extensions) end end end end end jekyll-commonmark-1.3.1/lib/jekyll-commonmark/0000755000004100000410000000000013514203551021377 5ustar www-datawww-datajekyll-commonmark-1.3.1/lib/jekyll-commonmark/version.rb0000644000004100000410000000014113514203551023405 0ustar www-datawww-data# frozen_string_literal: true module Jekyll module CommonMark VERSION = "1.3.1" end end jekyll-commonmark-1.3.1/History.markdown0000644000004100000410000000106013514203551020400 0ustar www-datawww-data## 1.3.1 / 2019-03-25 ### Bug Fixes * Re-introduce Ruby 2.3 support and test Jekyll 3.7+ (#32) ## 1.3.0 / 2019-03-22 ### Development Fixes * Allow Jekyll v4 (still alpha) * Drop Ruby < 2.4 * chore(deps): rubocop-jekyll 0.3.0 (#25) * Target Ruby 2.4 (#30) ## 1.2.0 / 2018-03-29 ### Minor Enhancements * Allow render options (#4) * Only set options once (#17) ### Development Fixes * Test plugin on Windows (#13) * Allow options passed to Rubocop (#15) * Add tests (#16) * Test against Ruby 2.5 (#18) * Version with class (#19) jekyll-commonmark-1.3.1/Gemfile0000644000004100000410000000020313514203551016464 0ustar www-datawww-data# frozen_string_literal: true source "https://rubygems.org" gemspec gem "jekyll", ENV["JEKYLL_VERSION"] if ENV["JEKYLL_VERSION"] jekyll-commonmark-1.3.1/appveyor.yml0000644000004100000410000000120113514203551017560 0ustar www-datawww-dataversion: "{build}" clone_depth: 5 build: off install: - SET PATH=C:\Ruby%RUBY_FOLDER_VER%-x64\bin;%PATH% - bundle install --retry 5 --jobs=%NUMBER_OF_PROCESSORS% --clean --path vendor\bundle environment: JEKYLL_VERSION: "~> 3.8" matrix: - RUBY_FOLDER_VER: "26" JEKYLL_VERSION : "~> 3.7.4" - RUBY_FOLDER_VER: "26" JEKYLL_VERSION : ">= 4.0.0.pre.alpha1" - RUBY_FOLDER_VER: "26" - RUBY_FOLDER_VER: "24" - RUBY_FOLDER_VER: "23" test_script: - ruby --version - gem --version - bundler --version - bash script/cibuild cache: - 'vendor\bundle -> appveyor.yml,Gemfile,jekyll-commonmark.gemspec' jekyll-commonmark-1.3.1/.github/0000755000004100000410000000000013514203551016536 5ustar www-datawww-datajekyll-commonmark-1.3.1/.github/stale.yml0000644000004100000410000000125413514203551020373 0ustar www-datawww-data# Number of days of inactivity before an issue becomes stale daysUntilStale: 60 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - pinned - security # Label to use when marking an issue as stale staleLabel: wontfix # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. # Comment to post when closing a stale issue. Set to `false` to disable closeComment: false