blob: f7dc5d5221c87b37108417d0babe9d54c22a1c0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# frozen_string_literal: true
Nanoc::Check.define(:internal_anchors) do
output_html_filenames.each do |file|
Gitlab::Docs::Page.new(file).links.each do |link|
next unless link.internal?
next unless link.to_anchor?
next if link.anchor_name == 'markdown-toc'
if link.destination_anchor_not_found?
add_issue <<~ERROR
Broken anchor detected!
- source file `#{link.source_file}`
- destination `#{link.destination_file}`
- link `#{link.href}`
- anchor `##{link.anchor_name}`
ERROR
end
end
end
add_issue "#{issues.count} offenses found!" if issues.count.positive?
end
|