jekyll-ruby-link-checker 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0223d27659e72a5fc9fd72e6fb89bb2436cca1d50f732c4d7f10c64c5609f1c8
4
+ data.tar.gz: 884bb29d0304ec21c3c45b6d8e97de7268b9e0e48bc0b81e4deefc1fa934f992
5
+ SHA512:
6
+ metadata.gz: 6e8976c6da5fb91932127a4e4ae6001fe7598162aa2c49428c869754ef0c3463cb355c679289aadcf1ab21ec852a7675768835abd52de175650e77f94b15391b
7
+ data.tar.gz: 4e5c6adba491066ba6b758ed0ef520d6a3f4c4457f4544d5cceb4a6fe107a6d65c9ec83701d2a513901ad37c02ead3fb33d874c552cb331e94f7440cb9d200c6
data/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026/11/23)
4
+
5
+ - [#2](https://github.com/dblock/jekyll-ruby-link-checker/pull/2): Check internal, anchor, relative, and external links during the build, with configuration, a persistent cache, and a reusable workflow that keeps the cache between runs - [@dblock](https://github.com/dblock).
6
+ - [#3](https://github.com/dblock/jekyll-ruby-link-checker/pull/3): Release with ruby-gem-release from a manually dispatched workflow, with RubyGems Trusted Publishing - [@dblock](https://github.com/dblock).
7
+ - [#4](https://github.com/dblock/jekyll-ruby-link-checker/pull/4): Write a Markdown report of dead links to `LINK_CHECKER_REPORT`, add it to the job summary of the reusable workflow, and optionally keep an issue with the dead links up to date - [@dblock](https://github.com/dblock).
8
+ - [#6](https://github.com/dblock/jekyll-ruby-link-checker/pull/6): Attach the link checker report to each run of the reusable workflow as an artifact - [@dblock](https://github.com/dblock).
9
+ - [#7](https://github.com/dblock/jekyll-ruby-link-checker/pull/7): Combine the `issue` and `issue-title` workflow inputs into `issue`, which takes `'true'`, a title, or an issue number - [@dblock](https://github.com/dblock).
10
+ - [#9](https://github.com/dblock/jekyll-ruby-link-checker/pull/9): Publish results with a separate reusable workflow that comments on pull requests and keeps the issue up to date from `workflow_run`, so links can be checked on pull requests from forks with read-only permissions - [@dblock](https://github.com/dblock).
11
+ - [#10](https://github.com/dblock/jekyll-ruby-link-checker/pull/10): Add `LINK_CHECKER_FAIL` and the `fail-on-dead-links` workflow input to report dead links without failing the build, for example on pull requests - [@dblock](https://github.com/dblock).
12
+ - [#11](https://github.com/dblock/jekyll-ruby-link-checker/pull/11): Add `LINK_CHECKER_CHANGED_FILES` and the `changed-files-only` workflow input, on by default, to only check the pages a pull request changes - [@dblock](https://github.com/dblock).
13
+ - [#14](https://github.com/dblock/jekyll-ruby-link-checker/pull/14): Fix reporting redirects and a failed HEAD before GET as dead links - [@dblock](https://github.com/dblock).
14
+ - [#15](https://github.com/dblock/jekyll-ruby-link-checker/pull/15): Upgrade to ruby-link-checker 0.6, report links blocked by bot protection as unverified without failing the build, and use ruby-link-checker's reasons - [@dblock](https://github.com/dblock).
15
+ - [#16](https://github.com/dblock/jekyll-ruby-link-checker/pull/16): Add the `blocked`, `detect_challenges`, `timeout`, `connect_timeout`, `host_concurrency`, `host_interval`, `headers`, and `host_headers` options - [@dblock](https://github.com/dblock).
16
+ - [#18](https://github.com/dblock/jekyll-ruby-link-checker/pull/18): Add the `cache.blocked_ttl` and `cache.prune` options - [@dblock](https://github.com/dblock).
17
+ - [#19](https://github.com/dblock/jekyll-ruby-link-checker/pull/19): Add the `permanent_redirects` option to report links that moved permanently, with the URL to update them to - [@dblock](https://github.com/dblock).
18
+ - [#20](https://github.com/dblock/jekyll-ruby-link-checker/pull/20): Keep the existing cache of a site at the repository root when switching to the reusable workflow, by caching the bare `cache-file` path - [@dblock](https://github.com/dblock).
19
+ - [#21](https://github.com/dblock/jekyll-ruby-link-checker/pull/21): Simplify the documentation - [@dblock](https://github.com/dblock).
20
+ - [#22](https://github.com/dblock/jekyll-ruby-link-checker/pull/22): Add a logo - [@dblock](https://github.com/dblock).
21
+ - [#23](https://github.com/dblock/jekyll-ruby-link-checker/pull/23): Accept regular expressions between slashes in `exclude.urls` - [@dblock](https://github.com/dblock).
22
+ - [#24](https://github.com/dblock/jekyll-ruby-link-checker/pull/24): List links in the report with the titles of the pages that link to them, instead of tables - [@dblock](https://github.com/dblock).
23
+ - [#25](https://github.com/dblock/jekyll-ruby-link-checker/pull/25): Group unverified links by site in the report, and collapse them - [@dblock](https://github.com/dblock).
24
+ - [#27](https://github.com/dblock/jekyll-ruby-link-checker/pull/27): Move the usage, configuration, and GitHub Actions documentation to `docs/`, add a guide to fixing links, linked from the report, and update the workflow version pins in the documentation on release - [@dblock](https://github.com/dblock).
25
+ - [#28](https://github.com/dblock/jekyll-ruby-link-checker/pull/28): Add the check as an action, `action.yml`, for GitHub Marketplace - [@dblock](https://github.com/dblock).
26
+ - [#29](https://github.com/dblock/jekyll-ruby-link-checker/pull/29): Suggest `exclude` settings for unverified links and sites that didn't answer properly in the report - [@dblock](https://github.com/dblock).
27
+ - [#30](https://github.com/dblock/jekyll-ruby-link-checker/pull/30): Post Danger comments on stacked pull requests - [@dblock](https://github.com/dblock).
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Daniel Doubrovkine
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,95 @@
1
+ <img alt="jekyll-ruby-link-checker" src="assets/logo.svg" width="128">
2
+
3
+ # Jekyll Ruby Link Checker
4
+
5
+ [![Test](https://github.com/dblock/jekyll-ruby-link-checker/actions/workflows/test.yml/badge.svg)](https://github.com/dblock/jekyll-ruby-link-checker/actions/workflows/test.yml) [![Lint](https://github.com/dblock/jekyll-ruby-link-checker/actions/workflows/lint.yml/badge.svg)](https://github.com/dblock/jekyll-ruby-link-checker/actions/workflows/lint.yml) [![Package](https://github.com/dblock/jekyll-ruby-link-checker/actions/workflows/package.yml/badge.svg)](https://github.com/dblock/jekyll-ruby-link-checker/actions/workflows/package.yml) [![Coverage Status](https://coveralls.io/repos/github/dblock/jekyll-ruby-link-checker/badge.svg?branch=master)](https://coveralls.io/github/dblock/jekyll-ruby-link-checker?branch=master)
6
+
7
+ A Jekyll plugin that checks the links in your site while it builds, and fails the build when a link is dead. It uses [ruby-link-checker](https://github.com/dblock/ruby-link-checker) for external links and remembers the ones that worked, so later builds are fast. It also comes with GitHub Actions workflows that check links on every push and pull request.
8
+
9
+ ## Installation
10
+
11
+ Add the gem to your `Gemfile`:
12
+
13
+ ```ruby
14
+ gem 'jekyll-ruby-link-checker'
15
+ ```
16
+
17
+ And to the plugins in `_config.yml`:
18
+
19
+ ```yaml
20
+ plugins:
21
+ - jekyll-ruby-link-checker
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ Check links while building your site:
27
+
28
+ ```sh
29
+ LINK_CHECKER=1 bundle exec jekyll build
30
+ ```
31
+
32
+ The build fails when it finds dead links, and lists them with the pages that link to them. Fix them, see [Fixing Links](docs/fixing-links.md), and run it again until it passes.
33
+
34
+ ## GitHub Actions
35
+
36
+ To check links on every push, every pull request, and twice a week, add this workflow:
37
+
38
+ ```yaml
39
+ # .github/workflows/check-links.yml
40
+ name: Check Links
41
+
42
+ on:
43
+ push:
44
+ branches: [main]
45
+ pull_request:
46
+ schedule:
47
+ - cron: '30 11 * * 0,3'
48
+
49
+ permissions:
50
+ contents: read
51
+
52
+ jobs:
53
+ check-links:
54
+ uses: dblock/jekyll-ruby-link-checker/.github/workflows/check-links.yml@v0.1.0
55
+ ```
56
+
57
+ A run fails when it finds dead links, and lists them in its summary. Fix them, push, and repeat until the run passes.
58
+
59
+ ```yaml
60
+ # .github/workflows/publish-link-checker-report.yml
61
+ name: Publish Link Checker Report
62
+
63
+ on:
64
+ workflow_run:
65
+ workflows: [Check Links]
66
+ types: [completed]
67
+
68
+ permissions:
69
+ actions: read
70
+ issues: write
71
+ pull-requests: write
72
+
73
+ jobs:
74
+ publish:
75
+ uses: dblock/jekyll-ruby-link-checker/.github/workflows/publish-report.yml@v0.1.0
76
+ with:
77
+ issue: 'true'
78
+ ```
79
+
80
+ See [GitHub Actions](docs/github-actions.md) for the options of both workflows, and for the action on GitHub Marketplace, which you can add as a step to a job of your own.
81
+
82
+ ## Documentation
83
+
84
+ - [Usage](docs/usage.md): what the plugin checks and reports.
85
+ - [Configuration](docs/configuration.md): every option of `link_checker` in `_config.yml`.
86
+ - [GitHub Actions](docs/github-actions.md): check links on every push and pull request, and report them in comments and an issue.
87
+ - [Fixing Links](docs/fixing-links.md): what to do about dead, unverified, and moved links.
88
+
89
+ ## Contributing
90
+
91
+ See [CONTRIBUTING.md](CONTRIBUTING.md), [DESIGN.md](DESIGN.md), [RELEASING.md](RELEASING.md), and [CHANGELOG.md](CHANGELOG.md).
92
+
93
+ ## License
94
+
95
+ MIT License, see [LICENSE.txt](LICENSE.txt).
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module RubyLinkChecker
5
+ # Selects the pages to check from the files a change touched, relative to the site source, for example in a pull
6
+ # request. Changed pages and documents are checked, and changed static files don't need checking. Any other
7
+ # change, such as a layout, an include, data, or configuration, can change every page, so all pages are checked.
8
+ class ChangedFiles
9
+ attr_reader :paths, :others
10
+
11
+ # The changed pages to check from the list in `file`, or nil to check all pages.
12
+ def self.pages(site, file)
13
+ return nil unless file
14
+
15
+ changed = new(site, read(file))
16
+ changed.pages.tap do |pages|
17
+ next if pages
18
+
19
+ Jekyll.logger.info('LinkChecker:', "Checking all pages, because #{changed.others.min} and " \
20
+ "#{changed.others.size - 1} other changed files aren't pages.")
21
+ end
22
+ end
23
+
24
+ def self.read(file)
25
+ File.readlines(file, chomp: true).map { |line| line.strip.delete_prefix('./').delete_prefix('/') }
26
+ .reject(&:empty?).to_set
27
+ end
28
+
29
+ def initialize(site, paths)
30
+ @paths = paths.to_set
31
+ @pages = (site.pages + site.documents).to_set(&:relative_path)
32
+ static = site.static_files.to_set { |file| file.relative_path.delete_prefix('/') }
33
+ @others = @paths - @pages - static
34
+ end
35
+
36
+ # The changed pages to check, or nil to check all pages.
37
+ def pages
38
+ @others.empty? ? @paths & @pages : nil
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,137 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'logger'
4
+
5
+ module Jekyll
6
+ module RubyLinkChecker
7
+ # Collects the links of one build and checks them once the site is written.
8
+ class Checker
9
+ HREF = /<a\s[^>]*?href=(["'])(.*?)\1/im
10
+ HTML_EXTENSIONS = %w[.html .htm].freeze
11
+
12
+ class << self
13
+ attr_reader :current
14
+
15
+ # Starts checking when LINK_CHECKER is set, so ordinary builds and `jekyll serve` stay fast.
16
+ def start(site)
17
+ @current = enabled? ? new(site) : nil
18
+ end
19
+
20
+ def finish
21
+ checker = @current
22
+ @current = nil
23
+ checker&.verify
24
+ end
25
+
26
+ def enabled?
27
+ value = ENV.fetch('LINK_CHECKER', '').strip.downcase
28
+ !value.empty? && !%w[0 false no off].include?(value)
29
+ end
30
+ end
31
+
32
+ attr_reader :config, :links, :report
33
+
34
+ def initialize(site)
35
+ @site = site
36
+ @config = Configuration.new(site.config['link_checker'])
37
+ @urls = Urls.new(site, @config.exclude)
38
+ @only = ChangedFiles.pages(site, @config.changed_files(site.source))
39
+ @report = new_report
40
+ @links = Hash.new { |hash, url| hash[url] = Set.new }
41
+ end
42
+
43
+ def collect(page)
44
+ return unless checked?(page)
45
+
46
+ @report.page(page.relative_path, title: page.data['title'], url: page_url(page))
47
+ hrefs(page).each do |href|
48
+ next check_anchor(page, href) if href.start_with?('#')
49
+
50
+ @links[@urls.resolve(page.url, href)] << page.relative_path
51
+ end
52
+ end
53
+
54
+ def verify
55
+ internal = InternalLinks.new(@site.dest, localize: @urls.method(:localize))
56
+ external = external_checker
57
+ @links.each { |href, locations| queue(href, locations.to_a, internal, external) }
58
+ external.run
59
+ @report.finish
60
+ end
61
+
62
+ private
63
+
64
+ def new_report
65
+ Report.new(verbose: @config.verbose?, file: @config.report_file(@site.source),
66
+ fail_on_dead_links: @config.fail_on_dead_links?, changed_pages: @only&.size,
67
+ permanent_redirects: @config.permanent_redirects?).tap { |report| report.site_url = site_url }
68
+ end
69
+
70
+ # Pages that opt out with `link_checker: false`, outputs other than HTML, and, with LINK_CHECKER_CHANGED_FILES,
71
+ # pages that didn't change are not checked.
72
+ def checked?(page)
73
+ page.data['link_checker'] != false && HTML_EXTENSIONS.include?(page.output_ext.to_s.downcase) &&
74
+ (@only.nil? || @only.include?(page.relative_path))
75
+ end
76
+
77
+ def hrefs(page)
78
+ page.content.to_s.scan(HREF).map { |_, href| CGI.unescapeHTML(href.strip) }.reject do |href|
79
+ href.empty? || href == '#'
80
+ end
81
+ end
82
+
83
+ def site_url
84
+ @site.config['url'].to_s.empty? ? nil : @site.config['url']
85
+ end
86
+
87
+ def page_url(page)
88
+ "#{site_url}#{@site.baseurl}#{page.url}" if site_url
89
+ end
90
+
91
+ def check_anchor(page, href)
92
+ return if InternalLinks.anchor?(page.output.to_s, href[1..])
93
+
94
+ @report.fail("#{page.url}#{href}", page.relative_path, 'anchor not found')
95
+ end
96
+
97
+ def queue(href, locations, internal, external)
98
+ url = @urls.localize(href)
99
+ return @report.count(:excluded) if @urls.excluded?(url)
100
+
101
+ if Urls.external?(url)
102
+ @report.count(:external)
103
+ external.check(url, locations: locations)
104
+ else
105
+ check_internal(href, url, locations, internal)
106
+ end
107
+ end
108
+
109
+ def check_internal(href, url, locations, internal)
110
+ @report.count(:internal)
111
+ reason = internal.check(url)
112
+ @report.log(href, reason || 'OK')
113
+ @report.fail(href, locations, reason) if reason
114
+ end
115
+
116
+ def external_checker
117
+ checker = LinkChecker::Typhoeus::Hydra::Checker.new(**checker_options)
118
+ # `complete` is published once per link with its final result, unlike `result`, which is published for every
119
+ # attempt, including each redirect. Cache hits are reported when a link is queued, before the checker runs.
120
+ checker.on(:complete) { |result| @report.record(result) }
121
+ checker
122
+ end
123
+
124
+ def checker_options
125
+ options = {
126
+ logger: @config.verbose? ? Jekyll.logger : Logger.new(IO::NULL),
127
+ hydra: { max_concurrency: @config.concurrency },
128
+ retries: @config.retries,
129
+ cache: @config.cache_options(@site.source, full: @only.nil?),
130
+ **@config.request_options
131
+ }
132
+ options[:user_agent] = @config.user_agent if @config.user_agent
133
+ options
134
+ end
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,125 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module RubyLinkChecker
5
+ # Settings from `link_checker` in `_config.yml`, validated when the build starts.
6
+ class Configuration
7
+ # Reuses successful external checks for `ttl`, and unverified ones for `blocked_ttl`, from a cache `file`,
8
+ # relative to the site source, and with `prune`, removes entries of links that a full check no longer checks.
9
+ Cache = Data.define(:file, :ttl, :blocked_ttl, :prune) do
10
+ def initialize(file: nil, ttl: '30d', blocked_ttl: nil, prune: false)
11
+ super(
12
+ file: file,
13
+ ttl: Values.duration(ttl, 'cache.ttl'),
14
+ blocked_ttl: blocked_ttl.nil? ? nil : Values.duration(blocked_ttl, 'cache.blocked_ttl'),
15
+ prune: Values.boolean(prune, 'cache.prune')
16
+ )
17
+ end
18
+ end
19
+
20
+ # Links that are never checked: external hosts and their subdomains, exact URLs, and path patterns.
21
+ Exclude = Data.define(:domains, :urls, :paths) do
22
+ def initialize(domains: [], urls: [], paths: [])
23
+ super(
24
+ domains: Values.list(domains, 'exclude.domains').map(&:downcase),
25
+ urls: Values.list(urls, 'exclude.urls').map { |url| Values.string_or_pattern(url, 'exclude.urls') },
26
+ paths: Values.list(paths, 'exclude.paths').map { |path| Values.pattern(path, 'exclude.paths') }
27
+ )
28
+ end
29
+ end
30
+
31
+ # Options passed to ruby-link-checker, with its name and a reader; unset options keep its defaults.
32
+ REQUEST_OPTIONS = {
33
+ 'blocked' => %i[blocked_status_codes status_codes],
34
+ 'detect_challenges' => %i[detect_challenges boolean],
35
+ 'timeout' => %i[timeout duration],
36
+ 'connect_timeout' => %i[connecttimeout duration],
37
+ 'host_concurrency' => %i[max_concurrency_per_host positive_integer],
38
+ 'host_interval' => %i[min_host_interval seconds],
39
+ 'headers' => %i[headers headers],
40
+ 'host_headers' => %i[host_headers host_headers]
41
+ }.freeze
42
+
43
+ OPTIONS = (%w[cache exclude concurrency retries user_agent verbose permanent_redirects] + REQUEST_OPTIONS.keys)
44
+ .freeze
45
+
46
+ attr_reader :cache, :exclude, :concurrency, :retries, :user_agent, :request_options
47
+
48
+ def initialize(raw)
49
+ raw ||= {}
50
+ Values.invalid!('', raw, 'a set of options') unless raw.is_a?(Hash)
51
+ Values.known!(raw, OPTIONS, '')
52
+ read(raw)
53
+ end
54
+
55
+ def verbose?
56
+ @verbose
57
+ end
58
+
59
+ def permanent_redirects?
60
+ @permanent_redirects
61
+ end
62
+
63
+ # LINK_CHECKER_CACHE overrides the configured cache file, for example in a CI workflow. Only a `full` check
64
+ # prunes, because a check of some pages would remove the entries of the links on the others.
65
+ def cache_options(source, full: true)
66
+ file = ENV.fetch('LINK_CHECKER_CACHE', '').strip
67
+ file = @cache.file.to_s if file.empty?
68
+ return nil if file.empty?
69
+
70
+ options = { file: File.expand_path(file, source), ttl: @cache.ttl }
71
+ options[:blocked_ttl] = @cache.blocked_ttl if @cache.blocked_ttl
72
+ options[:prune] = true if @cache.prune && full
73
+ options
74
+ end
75
+
76
+ # LINK_CHECKER_REPORT names a file for a Markdown report, for example in a CI workflow.
77
+ def report_file(source)
78
+ file = ENV.fetch('LINK_CHECKER_REPORT', '').strip
79
+ file.empty? ? nil : File.expand_path(file, source)
80
+ end
81
+
82
+ # LINK_CHECKER_CHANGED_FILES names a file that lists changed files, one per line, relative to the site source,
83
+ # to only check the pages that changed, for example in a pull request.
84
+ def changed_files(source)
85
+ file = ENV.fetch('LINK_CHECKER_CHANGED_FILES', '').strip
86
+ file.empty? ? nil : File.expand_path(file, source)
87
+ end
88
+
89
+ # LINK_CHECKER_FAIL=0 reports dead links without failing the build, for example on pull requests.
90
+ def fail_on_dead_links?
91
+ !%w[0 false no off].include?(ENV.fetch('LINK_CHECKER_FAIL', '').strip.downcase)
92
+ end
93
+
94
+ private
95
+
96
+ def read(raw)
97
+ @cache = section(Cache, raw['cache'], 'cache')
98
+ @exclude = section(Exclude, raw['exclude'], 'exclude')
99
+ @concurrency = Values.positive_integer(raw.fetch('concurrency', 5), 'concurrency')
100
+ @retries = Values.non_negative_integer(raw.fetch('retries', 1), 'retries')
101
+ @user_agent = raw['user_agent']&.to_s
102
+ @verbose = raw.fetch('verbose', false) == true
103
+ @permanent_redirects = Values.boolean(raw.fetch('permanent_redirects', false), 'permanent_redirects')
104
+ @request_options = read_request_options(raw)
105
+ end
106
+
107
+ def read_request_options(raw)
108
+ REQUEST_OPTIONS.select { |name, _| raw.key?(name) }.to_h do |name, (option, reader)|
109
+ [option, Values.public_send(reader, raw[name], name)]
110
+ end
111
+ end
112
+
113
+ def section(klass, value, name)
114
+ return klass.new if value.nil?
115
+
116
+ Values.invalid!(name, value, 'a set of options') unless value.is_a?(Hash)
117
+
118
+ options = value.transform_keys(&:to_sym)
119
+ Values.known!(options, klass.members, name)
120
+
121
+ klass.new(**options)
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Low priority, so links are collected after other plugins have changed the content.
4
+ Jekyll::Hooks.register :site, :pre_render, priority: :low do |site|
5
+ Jekyll::RubyLinkChecker::Checker.start(site)
6
+ end
7
+
8
+ Jekyll::Hooks.register %i[pages documents], :post_render, priority: :low do |page|
9
+ Jekyll::RubyLinkChecker::Checker.current&.collect(page)
10
+ end
11
+
12
+ Jekyll::Hooks.register :site, :post_write, priority: :low do |_site|
13
+ Jekyll::RubyLinkChecker::Checker.finish
14
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cgi'
4
+
5
+ module Jekyll
6
+ module RubyLinkChecker
7
+ # Checks links to pages of the built site, and anchors in them, against the destination directory.
8
+ class InternalLinks
9
+ MAX_REDIRECTS = 10
10
+ REDIRECT_TITLE = '<title>Redirecting'
11
+ HREF = /<a\s[^>]*?href=(["'])(.*?)\1/im
12
+
13
+ # `localize` turns absolute links to the site itself into paths.
14
+ def initialize(destination, localize: ->(url) { url })
15
+ @destination = destination
16
+ @localize = localize
17
+ @contents = {}
18
+ end
19
+
20
+ # Returns nil when the link works, or a reason it doesn't.
21
+ def check(url, redirects = 0)
22
+ path, fragment = url.split('#', 2)
23
+ fragment = nil if fragment.to_s.empty?
24
+ content = read(path)
25
+ return 'page not found' if content.nil?
26
+ return follow(content, fragment, redirects) if content.include?(REDIRECT_TITLE)
27
+ return nil if fragment.nil? || self.class.anchor?(content, fragment)
28
+
29
+ "anchor ##{fragment} not found"
30
+ end
31
+
32
+ def self.anchor?(content, fragment)
33
+ id = Regexp.escape(CGI.unescape(fragment))
34
+ content.match?(/<[a-z0-9-]+\s[^>]*?(?:id|name)=(["'])#{id}\1/i)
35
+ end
36
+
37
+ private
38
+
39
+ # Redirects to other sites are left unchecked here, and a redirect loop stops after MAX_REDIRECTS.
40
+ def follow(content, fragment, redirects)
41
+ target = redirect_target(content)
42
+ return nil if target.nil? || !target.start_with?('/') || redirects >= MAX_REDIRECTS
43
+
44
+ target = "#{target.split('#', 2).first}##{fragment}" if fragment
45
+ check(target, redirects + 1)
46
+ end
47
+
48
+ def read(path)
49
+ file = files_for(path).find { |candidate| File.file?(candidate) }
50
+ return nil unless file
51
+
52
+ @contents[file] ||= File.read(file)
53
+ end
54
+
55
+ # A path without an extension is a directory index, or a page served without its .html extension.
56
+ def files_for(path)
57
+ path = CGI.unescape(path.to_s)
58
+ path = "/#{path}" unless path.start_with?('/')
59
+ return [File.join(@destination, path)] unless File.extname(path).empty? || path.end_with?('/')
60
+
61
+ directory = path.end_with?('/') ? path : "#{path}/"
62
+ candidates = [File.join(@destination, directory, 'index.html')]
63
+ candidates << File.join(@destination, "#{directory.chomp('/')}.html") unless directory == '/'
64
+ candidates
65
+ end
66
+
67
+ def redirect_target(content)
68
+ match = content.match(HREF)
69
+ match && @localize.call(CGI.unescapeHTML(match[2]))
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module RubyLinkChecker
5
+ class Report
6
+ # Suggests `exclude` settings for links whose result may not be the same on the next run: unverified links, by
7
+ # site when a site has several, and dead links that failed because the site didn't answer properly. Pages that
8
+ # are gone are left out, because they need to be fixed.
9
+ module Exclusions
10
+ FLAKY = /\A(?:HTTP 5\d\d|Timeout|Connection error)/
11
+ EXCLUSIONS = "These links may work, but couldn't be checked reliably. After checking them in a browser, " \
12
+ 'add this to `_config.yml` to stop checking them.'
13
+
14
+ def exclusions_section
15
+ domains, urls = suggested_exclusions
16
+ return [] if domains.empty? && urls.empty?
17
+
18
+ ['### Suggested Exclusions', '', EXCLUSIONS, '', '<details><summary>_config.yml</summary>', '',
19
+ '```yaml', *exclusions_yaml(domains, urls), '```', '', '</details>']
20
+ end
21
+
22
+ private
23
+
24
+ def exclusions_yaml(domains, urls)
25
+ ['link_checker:', ' exclude:',
26
+ *yaml_list('domains', domains.map { |host, count| "#{host} # #{plural(count, 'unverified link')}" }),
27
+ *yaml_list('urls', urls.map { |url, reason| "'#{url.gsub("'", "''")}' # #{reason}" })]
28
+ end
29
+
30
+ def yaml_list(name, items)
31
+ items.empty? ? [] : [" #{name}:", *items.map { |item| " - #{item}" }]
32
+ end
33
+
34
+ # Sites with several unverified links, by how many, and other unverified and flaky links, with their reason.
35
+ def suggested_exclusions
36
+ several, single = unverified_sites.partition { |_host, links| links.size > 1 }
37
+ urls = (single.flat_map(&:last) + flaky_failures).map { |url, link| [url, link[:reason]] }
38
+ [site_counts(several), urls.sort]
39
+ end
40
+
41
+ def unverified_sites
42
+ @unverified.group_by { |url, _link| URI(url).host }
43
+ end
44
+
45
+ def site_counts(sites)
46
+ sites.map { |host, links| [host, links.size] }.sort_by { |host, count| [-count, host] }
47
+ end
48
+
49
+ def flaky_failures
50
+ @failures.select { |url, link| url.match?(%r{\Ahttps?://}) && link[:reason].match?(FLAKY) }.to_a
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module RubyLinkChecker
5
+ class Report
6
+ # Text of the summary and the log messages.
7
+ module Formatting
8
+ def summary
9
+ "Checked #{@counts[:internal]} internal and #{@counts[:external]} external links " \
10
+ "(#{@counts[:cached]} cached)#{scope}, skipped #{@counts[:excluded]}.#{unverified_summary}#{moved_summary}"
11
+ end
12
+
13
+ def message
14
+ "Found #{plural(@failures.size, 'dead link')}:\n#{list(@failures)}"
15
+ end
16
+
17
+ def unverified_message
18
+ "Couldn't verify #{plural(@unverified.size, 'link')}, which bot protection blocked:\n#{list(@unverified)}"
19
+ end
20
+
21
+ def moved_message
22
+ "#{plural(@moved.size, 'link')} moved permanently:\n#{list(@moved, '%<url>s to %<reason>s')}"
23
+ end
24
+
25
+ private
26
+
27
+ def plural(count, noun)
28
+ "#{count} #{noun}#{'s' unless count == 1}"
29
+ end
30
+
31
+ def list(links, template = '%<url>s (%<reason>s)')
32
+ links.sort.map do |url, link|
33
+ "#{format(template, url: url, reason: link[:reason])}, linked from #{link[:locations].sort.join(', ')}"
34
+ end.join("\n")
35
+ end
36
+
37
+ def unverified_summary
38
+ @unverified.empty? ? '' : " Couldn't verify #{plural(@unverified.size, 'link')}."
39
+ end
40
+
41
+ def moved_summary
42
+ @moved.empty? ? '' : " #{plural(@moved.size, 'link')} moved permanently."
43
+ end
44
+
45
+ def scope
46
+ return '' unless @changed_pages
47
+
48
+ " on #{plural(@changed_pages, 'changed page')}"
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module RubyLinkChecker
5
+ class Report
6
+ # The Markdown report: lists of links with the pages that link to them, by title, which read better than tables
7
+ # of long URLs and source paths in issues, comments, and job summaries.
8
+ module Markdown
9
+ # A Markdown report starts with this marker, so a workflow can read the number of dead links.
10
+ MARKER = 'jekyll-ruby-link-checker dead links:'
11
+ UNVERIFIED = 'Bot protection blocked these checks, so these links may work. Check them in a browser.'
12
+ MOVED = 'These links work, but redirect permanently. Update them to link to where they moved.'
13
+ GUIDE = 'See [how to fix these links](https://github.com/dblock/jekyll-ruby-link-checker/blob/master/docs/fixing-links.md).'
14
+ # Pages listed under a link before the rest are collapsed.
15
+ PAGES_SHOWN = 3
16
+ # Longest link text before it's shortened.
17
+ TEXT_LENGTH = 60
18
+
19
+ def markdown
20
+ lines = ["<!-- #{MARKER} #{@failures.size} -->", '', summary, '']
21
+ lines += @failures.empty? ? ['No dead links.'] : section(@failures, 'Dead Link')
22
+ lines += ['', *unverified_section] unless @unverified.empty?
23
+ lines += ['', *section(@moved, 'Link', MOVED, moved: true)] unless @moved.empty?
24
+ exclusions = exclusions_section
25
+ lines += ['', *exclusions] unless exclusions.empty?
26
+ lines += ['', GUIDE] unless [@failures, @unverified, @moved].all?(&:empty?)
27
+ "#{lines.join("\n")}\n"
28
+ end
29
+
30
+ private
31
+
32
+ def section(links, noun, note = nil, moved: false)
33
+ title = moved ? "#{plural(links.size, noun)} Moved Permanently" : plural(links.size, noun)
34
+ ["### #{title}", '', *([note, ''] if note), *links.sort.flat_map { |url, link| item(url, link, moved) }]
35
+ end
36
+
37
+ # Unverified links often outnumber dead ones and come from a few sites, so they're grouped by site and
38
+ # collapsed. A link is only blocked after a server answered, so it has a host.
39
+ def unverified_section
40
+ sites = @unverified.group_by { |url, _link| URI(url).host }.sort_by { |name, links| [-links.size, name] }
41
+ ["### #{plural(@unverified.size, 'Unverified Link')}", '', UNVERIFIED, '',
42
+ "<details><summary>#{plural(sites.size, 'site')}</summary>", '',
43
+ *sites.flat_map { |name, links| site(name, links) }, '', '</details>']
44
+ end
45
+
46
+ def site(name, links)
47
+ reasons = links.map { |_url, link| link[:reason] }.uniq.sort.map { |reason| escape(reason) }.join(', ')
48
+ ["- #{escape(name)}: #{plural(links.size, 'link')}, #{reasons}",
49
+ *links.sort.map { |url, _link| " - #{link_to(url)}" }]
50
+ end
51
+
52
+ def item(url, link, moved)
53
+ detail = moved ? "moved to #{link_to(link[:reason])}" : "(#{escape(link[:reason])})"
54
+ ["- #{link_to(url)} #{detail}", *pages(link[:locations])]
55
+ end
56
+
57
+ def pages(locations)
58
+ links = locations.map { |location| page_link(location) }.sort_by(&:downcase)
59
+ shown = links.first(PAGES_SHOWN).map { |page| " - #{page}" }
60
+ rest = links.drop(PAGES_SHOWN)
61
+ return shown if rest.empty?
62
+
63
+ shown + [" - <details><summary>#{plural(rest.size, 'more page')}</summary>", '',
64
+ *rest.map { |page| " - #{page}" }, '', ' </details>']
65
+ end
66
+
67
+ # Every location is a page that the checker recorded.
68
+ def page_link(location)
69
+ page = @pages.fetch(location)
70
+ text = escape(page[:title] || location)
71
+ page[:url] ? "[#{text}](<#{page[:url]}>)" : text
72
+ end
73
+
74
+ # Shows a link without its scheme and shortened, and links to all of it; paths link to the site, when known.
75
+ # A trailing slash is kept, so that two links that differ only by one don't look the same.
76
+ def link_to(url)
77
+ href = url.start_with?('/') && @site_url ? "#{@site_url}#{url}" : url
78
+ text = escape(shorten(url))
79
+ href.match?(%r{\Ahttps?://}) ? "[#{text}](<#{href}>)" : text
80
+ end
81
+
82
+ def shorten(url)
83
+ text = url.sub(%r{\Ahttps?://}, '')
84
+ text.length > TEXT_LENGTH ? "#{text[0, TEXT_LENGTH - 1]}…" : text
85
+ end
86
+
87
+ def escape(text)
88
+ text.to_s.gsub(/[\\`*_\[\]<>|]/) { |char| "\\#{char}" }
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,107 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require_relative 'report/formatting'
5
+ require_relative 'report/markdown'
6
+ require_relative 'report/exclusions'
7
+
8
+ module Jekyll
9
+ module RubyLinkChecker
10
+ # Raised at the end of a build that found dead links, so the build fails, unless dead links are only reported.
11
+ class DeadLinksError < StandardError; end
12
+
13
+ # Counts checked links and collects dead ones with the pages that link to them.
14
+ class Report
15
+ include Formatting
16
+ include Markdown
17
+ include Exclusions
18
+
19
+ attr_reader :counts, :failures, :unverified, :moved
20
+
21
+ # Writes a Markdown report to `file`, when set, at the end of the build, and fails the build on dead links
22
+ # unless `fail_on_dead_links` is false. `changed_pages` counts the pages checked when only changed ones are.
23
+ # With `permanent_redirects`, working links that moved permanently are reported with their new URL.
24
+ def initialize(verbose:, file: nil, fail_on_dead_links: true, changed_pages: nil, permanent_redirects: false)
25
+ @verbose = verbose
26
+ @file = file
27
+ @fail_on_dead_links = fail_on_dead_links
28
+ @changed_pages = changed_pages
29
+ @permanent_redirects = permanent_redirects
30
+ @counts = Hash.new(0)
31
+ @failures = {}
32
+ @unverified = {}
33
+ @moved = {}
34
+ @pages = {}
35
+ end
36
+
37
+ # With the site's URL, the report links to the site's pages and its dead links.
38
+ def site_url=(url)
39
+ @site_url = url&.delete_suffix('/')
40
+ end
41
+
42
+ # Remembers the title and URL of a page, by its source path, so the report can link to it.
43
+ def page(path, title: nil, url: nil)
44
+ @pages[path] = { title: title, url: url }
45
+ end
46
+
47
+ def count(kind)
48
+ @counts[kind] += 1
49
+ end
50
+
51
+ def fail(url, locations, reason)
52
+ add(@failures, url, locations, reason)
53
+ end
54
+
55
+ # Records the final result of an external link from ruby-link-checker. Links blocked by bot protection may work,
56
+ # so they're unverified rather than dead, and don't fail the build.
57
+ def record(result)
58
+ url = result.uri.to_s
59
+ count(:cached) if result.cached?
60
+ return success(url, result) if result.success?
61
+
62
+ log(url, result.blocked? ? "#{result.reason}, unverified" : result.reason)
63
+ add(result.blocked? ? @unverified : @failures, url, result.options[:locations], result.reason)
64
+ end
65
+
66
+ def log(url, status)
67
+ Jekyll.logger.info('LinkChecker:', "#{url}: #{status}") if @verbose
68
+ end
69
+
70
+ def finish
71
+ Jekyll.logger.info('LinkChecker:', summary)
72
+ write(@file) if @file
73
+ warn_unverified_and_moved
74
+ return if @failures.empty?
75
+ return Jekyll.logger.warn('LinkChecker:', message) unless @fail_on_dead_links
76
+
77
+ Jekyll.logger.error('LinkChecker:', message)
78
+ raise DeadLinksError, message
79
+ end
80
+
81
+ private
82
+
83
+ def add(links, url, locations, reason)
84
+ links[url] ||= { reason: reason, locations: Set.new }
85
+ links[url][:locations].merge(Array(locations))
86
+ end
87
+
88
+ def success(url, result)
89
+ log(url, result.cached? ? 'OK (cached)' : 'OK')
90
+ return unless @permanent_redirects && result.permanent_redirect?
91
+
92
+ add(@moved, url, result.options[:locations], result.result_uri.to_s)
93
+ end
94
+
95
+ # Unverified and moved links don't fail the build.
96
+ def warn_unverified_and_moved
97
+ Jekyll.logger.warn('LinkChecker:', unverified_message) unless @unverified.empty?
98
+ Jekyll.logger.warn('LinkChecker:', moved_message) unless @moved.empty?
99
+ end
100
+
101
+ def write(file)
102
+ FileUtils.mkdir_p(File.dirname(file))
103
+ File.write(file, markdown)
104
+ end
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'uri'
4
+
5
+ module Jekyll
6
+ module RubyLinkChecker
7
+ # Turns the links found in pages into what gets checked: paths for the site's own pages, and URLs elsewhere.
8
+ class Urls
9
+ EXTERNAL = %r{\Ahttps?://}i
10
+ SCHEME = /\A[a-z][a-z0-9+.-]*:/i
11
+
12
+ def initialize(site, exclude)
13
+ @exclude = exclude
14
+ root = "#{site.config['url'].to_s.chomp('/')}#{site.baseurl.to_s.chomp('/')}"
15
+ @site_url = %r{\A#{Regexp.escape(root)}(/.*|\z)}i unless site.config['url'].to_s.empty?
16
+ end
17
+
18
+ def self.external?(url)
19
+ url.match?(EXTERNAL)
20
+ end
21
+
22
+ # Resolves a relative link, such as `../about/`, against the URL of the page that contains it.
23
+ def resolve(page_url, href)
24
+ return href if href.start_with?('/') || href.match?(SCHEME)
25
+
26
+ resolved = URI.join('https://site.invalid', page_url.to_s, href)
27
+ resolved.fragment ? "#{resolved.path}##{resolved.fragment}" : resolved.path
28
+ rescue URI::Error
29
+ href
30
+ end
31
+
32
+ # Turns scheme-relative links into `https` URLs, and absolute links to the site itself into paths.
33
+ def localize(href)
34
+ url = href.start_with?('//') ? "https:#{href}" : href
35
+ match = @site_url&.match(url)
36
+ return url unless match
37
+
38
+ match[1].empty? ? '/' : match[1]
39
+ end
40
+
41
+ # Links with other schemes, such as `mailto:`, and configured exclusions are not checked.
42
+ def excluded?(url)
43
+ return true if url.match?(SCHEME) && !self.class.external?(url)
44
+ return true if excluded_url?(url)
45
+ return true if @exclude.paths.any? { |pattern| pattern.match?(url) }
46
+
47
+ self.class.external?(url) && excluded_domain?(url)
48
+ end
49
+
50
+ private
51
+
52
+ # Excluded URLs are exact, or regular expressions.
53
+ def excluded_url?(url)
54
+ @exclude.urls.any? { |excluded| excluded.is_a?(Regexp) ? excluded.match?(url) : excluded == url }
55
+ end
56
+
57
+ def excluded_domain?(url)
58
+ host = URI.parse(url).host.to_s.downcase
59
+ @exclude.domains.any? { |domain| host == domain || host.end_with?(".#{domain}") }
60
+ rescue URI::InvalidURIError
61
+ false
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module RubyLinkChecker
5
+ # Reads and validates values of `link_checker` options, naming the option in errors.
6
+ module Values
7
+ DURATION_UNITS = { 's' => 1, 'm' => 60, 'h' => 3600, 'd' => 86_400, 'w' => 604_800 }.freeze
8
+
9
+ module_function
10
+
11
+ def duration(value, name)
12
+ return value if value.is_a?(Integer) && value.positive?
13
+
14
+ match = /\A(\d+)\s*([smhdw]?)\z/.match(value.to_s.strip)
15
+ invalid!(name, value, 'a positive number of seconds or a duration such as 12h or 30d') unless match
16
+
17
+ seconds = Integer(match[1], 10) * DURATION_UNITS.fetch(match[2], 1)
18
+ invalid!(name, value, 'a positive duration') unless seconds.positive?
19
+ seconds
20
+ end
21
+
22
+ # A number of seconds, which can be a fraction, or a duration such as 2s.
23
+ def seconds(value, name)
24
+ return value if value.is_a?(Numeric) && value.positive?
25
+
26
+ duration(value, name)
27
+ end
28
+
29
+ def list(value, name)
30
+ invalid!(name, value, 'a list') unless value.is_a?(Array)
31
+
32
+ value.map(&:to_s)
33
+ end
34
+
35
+ def pattern(value, name)
36
+ Regexp.new(value)
37
+ rescue RegexpError => e
38
+ invalid!(name, value, "a regular expression (#{e.message})")
39
+ end
40
+
41
+ def boolean(value, name)
42
+ invalid!(name, value, 'true or false') unless [true, false].include?(value)
43
+ value
44
+ end
45
+
46
+ def positive_integer(value, name)
47
+ invalid!(name, value, 'a positive integer') unless value.is_a?(Integer) && value.positive?
48
+ value
49
+ end
50
+
51
+ def non_negative_integer(value, name)
52
+ invalid!(name, value, 'zero or a positive integer') unless value.is_a?(Integer) && !value.negative?
53
+ value
54
+ end
55
+
56
+ # `false` or an empty list reports no status as blocked.
57
+ def status_codes(value, name)
58
+ return [] if value == false
59
+ return value if value.is_a?(Array) && value.all? { |code| code.is_a?(Integer) && code.between?(100, 999) }
60
+
61
+ invalid!(name, value, 'false or a list of HTTP status codes')
62
+ end
63
+
64
+ def headers(value, name)
65
+ return value if value.is_a?(Hash) && value.all? { |key, header| key.is_a?(String) && header.is_a?(String) }
66
+
67
+ invalid!(name, value, 'a set of header names and values')
68
+ end
69
+
70
+ # A string between slashes, such as /(\A|\.)medium\.com\z/, is a regular expression; any other string is matched
71
+ # exactly. YAML can't hold a Ruby Regexp.
72
+ def string_or_pattern(value, name)
73
+ value = value.to_s
74
+ value.length > 2 && value.start_with?('/') && value.end_with?('/') ? pattern(value[1..-2], name) : value
75
+ end
76
+
77
+ def host_headers(value, name)
78
+ invalid!(name, value, 'a set of hosts and their headers') unless value.is_a?(Hash)
79
+
80
+ value.to_h do |host, headers|
81
+ [string_or_pattern(host, name), headers(headers, "#{name}.#{host}")]
82
+ end
83
+ end
84
+
85
+ def invalid!(name, value, expected)
86
+ raise Jekyll::Errors::InvalidConfigurationError, "#{option(name)} must be #{expected}, got #{value.inspect}"
87
+ end
88
+
89
+ def known!(options, valid, name)
90
+ unknown = options.keys.map(&:to_s) - valid.map(&:to_s)
91
+ return if unknown.empty?
92
+
93
+ raise Jekyll::Errors::InvalidConfigurationError,
94
+ "Unknown #{option(name)} option: #{unknown.join(', ')}. Valid options: #{valid.join(', ')}"
95
+ end
96
+
97
+ def option(name)
98
+ name.empty? ? 'link_checker' : "link_checker.#{name}"
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module RubyLinkChecker
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'jekyll'
4
+ require 'typhoeus'
5
+ require 'ruby-link-checker'
6
+
7
+ require_relative 'jekyll-ruby-link-checker/version'
8
+ require_relative 'jekyll-ruby-link-checker/values'
9
+ require_relative 'jekyll-ruby-link-checker/configuration'
10
+ require_relative 'jekyll-ruby-link-checker/internal_links'
11
+ require_relative 'jekyll-ruby-link-checker/urls'
12
+ require_relative 'jekyll-ruby-link-checker/report'
13
+ require_relative 'jekyll-ruby-link-checker/changed_files'
14
+ require_relative 'jekyll-ruby-link-checker/checker'
15
+ require_relative 'jekyll-ruby-link-checker/hooks'
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-ruby-link-checker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Doubrovkine
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2026-11-23 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: jekyll
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '4.0'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '5'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '4.0'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '5'
32
+ - !ruby/object:Gem::Dependency
33
+ name: ruby-link-checker
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - "~>"
37
+ - !ruby/object:Gem::Version
38
+ version: '0.6'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - "~>"
44
+ - !ruby/object:Gem::Version
45
+ version: '0.6'
46
+ - !ruby/object:Gem::Dependency
47
+ name: typhoeus
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.4'
53
+ type: :runtime
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.4'
60
+ description: A Jekyll plugin that checks internal, anchor, and external links during
61
+ the build with ruby-link-checker, caching successful checks across builds.
62
+ email:
63
+ - dblock@users.noreply.github.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - CHANGELOG.md
69
+ - LICENSE.txt
70
+ - README.md
71
+ - lib/jekyll-ruby-link-checker.rb
72
+ - lib/jekyll-ruby-link-checker/changed_files.rb
73
+ - lib/jekyll-ruby-link-checker/checker.rb
74
+ - lib/jekyll-ruby-link-checker/configuration.rb
75
+ - lib/jekyll-ruby-link-checker/hooks.rb
76
+ - lib/jekyll-ruby-link-checker/internal_links.rb
77
+ - lib/jekyll-ruby-link-checker/report.rb
78
+ - lib/jekyll-ruby-link-checker/report/exclusions.rb
79
+ - lib/jekyll-ruby-link-checker/report/formatting.rb
80
+ - lib/jekyll-ruby-link-checker/report/markdown.rb
81
+ - lib/jekyll-ruby-link-checker/urls.rb
82
+ - lib/jekyll-ruby-link-checker/values.rb
83
+ - lib/jekyll-ruby-link-checker/version.rb
84
+ homepage: https://github.com/dblock/jekyll-ruby-link-checker
85
+ licenses:
86
+ - MIT
87
+ metadata:
88
+ bug_tracker_uri: https://github.com/dblock/jekyll-ruby-link-checker/issues
89
+ changelog_uri: https://github.com/dblock/jekyll-ruby-link-checker/blob/master/CHANGELOG.md
90
+ rubygems_mfa_required: 'true'
91
+ source_code_uri: https://github.com/dblock/jekyll-ruby-link-checker
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '3.3'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubygems_version: 4.0.20
107
+ specification_version: 4
108
+ summary: Check links in a Jekyll site during the build.
109
+ test_files: []