Skip to content

Commit 5a2cb15

Browse files
committed
Ignore links like '//google.com' when building TOC
1 parent 5208788 commit 5a2cb15

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/contents.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def subpages_for filename
3838
# (markdown) links of the form: [link text](link_page)
3939
content.scan /\[.*?\]\((.*?)\)/ do |link, _|
4040
next if (link =~ /^http/)
41+
next if (link =~ %r(^//)) # protocol-less absolute links e.g. //google.com
4142
next if (link =~ /(jpg|png)$/)
4243
links.push(link) if !links.include? link
4344
end

0 commit comments

Comments
 (0)