diff --git a/examples/html.feature b/examples/html.feature
index ae4d07d..16a712b 100644
--- a/examples/html.feature
+++ b/examples/html.feature
@@ -22,3 +22,21 @@ Feature: HTML
"""
When I successfully run `liche foo.html`
Then the stderr should contain exactly ""
+
+ Scenario: Ignore id reference
+ Given a file named "foo.html" with:
+ """
+
+
+
+ My title
+
+
+
+
+
+ """
+ When I successfully run `liche foo.html`
+ Then the stderr should contain exactly ""
diff --git a/file_checker.go b/file_checker.go
index fe642d7..c2a1720 100644
--- a/file_checker.go
+++ b/file_checker.go
@@ -4,6 +4,7 @@ import (
"bytes"
"io/ioutil"
"net/url"
+ "strings"
"sync"
"time"
@@ -118,6 +119,10 @@ func extractURLs(n *html.Node) []string {
}
func isURL(s string) bool {
+ if strings.HasPrefix(s, "#") {
+ return false
+ }
+
u, err := url.Parse(s)
return err == nil && (u.Scheme == "" || u.Scheme == "http" || u.Scheme == "https")
}
diff --git a/file_checker_test.go b/file_checker_test.go
index 7adc17b..13d8ed7 100644
--- a/file_checker_test.go
+++ b/file_checker_test.go
@@ -53,7 +53,7 @@ func TestIsURL(t *testing.T) {
assert.True(t, isURL(s))
}
- for _, s := range []string{"ftp://foo.com", "file://file-path"} {
+ for _, s := range []string{"ftp://foo.com", "file://file-path", "#foo"} {
assert.False(t, isURL(s))
}
}