diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf76132..a360a55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,6 @@ jobs: ruby: [2.4, 2.5, 2.6, 2.7] gemfile: - gemfiles/jekyll_4.0.gemfile - - gemfiles/jekyll_3.8.gemfile - - gemfiles/jekyll_3.7.gemfile exclude: - ruby: 2.4 gemfile: gemfiles/jekyll_4.0.gemfile diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f4f9b9d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +language: ruby +cache: bundler +env: + global: + - CC_TEST_REPORTER_ID=6b81e393ea6ad38560386f650ea2fb0e57a7beb5e20f8c8364fabee30d5bff07 +rvm: + - 2.4.6 + - 2.5.5 + - 2.6.3 +# gemfile is generated by appraisal +gemfile: + - gemfiles/jekyll_3.8.gemfile + - gemfiles/jekyll_3.7.gemfile + - gemfiles/jekyll_3.6.gemfile +before_script: + # Download cc-test-reporter + - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + - chmod +x ./cc-test-reporter + - ./cc-test-reporter before-build +after_success: + - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT + - bundle exec codeclimate-test-reporter diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..b672130 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "name": "Rake fd:test", + "type": "Ruby", + "request": "launch", + "cwd": "${workspaceRoot}", + "program": "${workspaceRoot}/bin/rake", + "useBundler": true, + "args": ["fd:test"] + } + ] +} \ No newline at end of file diff --git a/.whitesource b/.whitesource new file mode 100644 index 0000000..e0aaa3e --- /dev/null +++ b/.whitesource @@ -0,0 +1,8 @@ +{ + "checkRunSettings": { + "vulnerableCheckRunConclusionLevel": "failure" + }, + "issueSettings": { + "minSeverityLevel": "LOW" + } +} \ No newline at end of file diff --git a/Appraisals b/Appraisals index b84be41..049a0a8 100644 --- a/Appraisals +++ b/Appraisals @@ -1,13 +1,5 @@ -# frozen_string_literal: true - -appraise 'jekyll-4.0' do - gem 'jekyll', '4.0' -end - -appraise 'jekyll-3.8' do - gem 'jekyll', '3.8' -end - -appraise 'jekyll-3.7' do - gem 'jekyll', '3.7' -end +# frozen_string_literal: true + +appraise 'jekyll-4.0' do + gem 'jekyll', '4.0' +end diff --git a/LICENSE.md b/LICENSE.md index 5763175..d27c0bd 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020 Toshimaru +Copyright (c) 2020 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index e85fc30..e8cdf60 100644 --- a/README.md +++ b/README.md @@ -1,247 +1,258 @@ -# jekyll-toc - - -[](http://badge.fury.io/rb/jekyll-toc) -[](https://codeclimate.com/github/toshimaru/jekyll-toc) -[](https://codeclimate.com/github/toshimaru/jekyll-toc/test_coverage) - -## Table of Contents - -- [Installation](#installation) -- [Usage](#usage) - - [1. Basic Usage](#1-basic-usage) - - [2. Advanced Usage](#2-advanced-usage) -- [Generated HTML](#generated-html) -- [Default Configuration](#default-configuration) -- [Customization](#customization) - - [TOC levels](#toc-levels) - - [Skip TOC](#skip-toc) - - [Skip TOC Section](#skip-toc-section) - - [CSS Styling](#css-styling) - - [Custom CSS Class](#custom-css-class) - -## Installation - -Add jekyll-toc plugin in your site's `Gemfile`, and run `bundle install`. - -```ruby -gem 'jekyll-toc' -``` - -Add jekyll-toc to the `gems:` section in your site's `_config.yml`. - -```yml -plugins: - - jekyll-toc -``` - -Set `toc: true` in posts for which you want the TOC to appear. - -```yml ---- -layout: post -title: "Welcome to Jekyll!" -toc: true ---- -``` - -## Usage - -There are three Liquid filters, which can be applied to HTML content, -e.g. the Liquid variable `content` available in Jekyll's templates. - -### 1. Basic Usage - -#### `toc` filter - -Add the `toc` filter to your site's `{{ content }}` (e.g. `_layouts/post.html`). - -```liquid -{{ content | toc }} -``` - -This filter places the TOC directly above the content. - -### 2. Advanced Usage - -If you'd like separated TOC and content, you can use `{% toc %}` tag (or `toc_only` filter) and `inject_anchors` filter. - -#### `{% toc %}` tag - -Generates the TOC itself as described [below](#generated-html). -Mostly useful in cases where the TOC should _not_ be placed immediately -above the content but at some other place of the page, i.e. an aside. - -```html -