jekyll-external-links 1.0.0 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5491051e0ca68c8d51fb38d75253c02840b2c48034c0ab32ad2a23458968ad2
4
- data.tar.gz: 262dbe240bd7aa8a2dbfa213d97120da987668edf5a7f29378c3f4eb77345930
3
+ metadata.gz: 4efb8b28bc048b183d977ab09009166623eea525df19880e2db33644fe912e82
4
+ data.tar.gz: 6d34b1008c0b3388dc9853d97cdfddcbaa47915f1f14957c120b887cd8748e2c
5
5
  SHA512:
6
- metadata.gz: 81f80e33df4b5de6bdc49811aa4069b88ef493994518d62fd172cebabc645ee667074098030111d87cbfa9c32b8a1204a33b515671c53790cd89f0be0fb75f2d
7
- data.tar.gz: d59e34609425a96b7331e1411901f602c83cb2033007ceaa6ac5d19f0fd56ae90082dc1d19b3582e740c0fa416f5cfed5649636cac6d9c14dc7b317ea6c34470
6
+ metadata.gz: c0d6c8cc12e7c60bae9662fc0e2aced14b88177db0995a23853e914d2c175a849e4d444f2d2accaa3355f7f07179e6c202b944d688375e28b8d2278fa498ed76
7
+ data.tar.gz: 0e3dc41fa245e54b6487644e32791508bffbf064b2631d5d104e988e0f158cf5c33184b98959b4999effd6ade73caa8d1811ae10e0ceb50906a4a6e3432e1faa
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  example-site/_site
2
+ example-site/vendor
data/README.md CHANGED
@@ -1,15 +1,29 @@
1
1
  # Jekyll plugin that marks external links
2
2
 
3
- In each Jekyll document or page content, updates `<a>` elements that point
4
- to external sites as follows:
3
+ In rendered HTML contents of each Jekyll document or page,
4
+ updates `<a>` elements that point to external sites as follows:
5
5
 
6
6
  - Adds `rel="external"` attribute
7
7
  - Adds inner HTML markup with external link icon
8
8
 
9
- You can specify a CSS selector for which links are to be marked,
9
+ You can specify a CSS selector for which links are to be evaluated,
10
10
  and a list of selectors for which links are to be ignored
11
11
  (ignored selectors take precedence).
12
12
 
13
+ ## Which links are considered external
14
+
15
+ A link is considered external if:
16
+
17
+ * Its `href` attribute value starts with “http” or “https”, and
18
+ * the domain name following “http(s)://” is not equal to the
19
+ domain name part from site’s URL,
20
+ if such is specified in Jekyll configuration as `url`.
21
+
22
+ ## Compatibility and dependency notes
23
+
24
+ * Tested with Jekyll 4.3.2; see example site’s gem lockfile for further details.
25
+ * Depends on Nokogiri for detecting and marking external links.
26
+
13
27
  ## Configuration
14
28
 
15
29
  Example configuration with defaults:
@@ -24,12 +38,44 @@ external_links:
24
38
  marker_html: "<span class='ico-ext'><i class='fas fa-external-link-square-alt'></i></span>"
25
39
  ```
26
40
 
27
- As you can see, by default the Font Awesome’s `fa-external-link-square-alt` icon is used,
28
- which implies that you are using Font Awesome.
41
+ Note the assumptions made by the defaults:
42
+
43
+ * Links you want to be marked as external are always within the `<main>` tag.
44
+
45
+ * You use Font Awesome in your site.
46
+
47
+ * Links containing “travis”, “coverity” and “codecov”
48
+ are only used in badges, and you don’t want to process those.
49
+
50
+ If some of these assumptions don’t apply to your site,
51
+ you can add that structure to your `_config.yml` and customize the values.
52
+
53
+ ### `external_links.selector`
54
+
55
+ Only links matching this CSS path will be processed.
56
+
57
+ ### `external_links.marker_html`
29
58
 
30
- You can set marker_html to empty string and style links with custom CSS rule
59
+ The specified HTML markup will be added inside each `<a>` tag
60
+ that’s detected as external link.
61
+
62
+ By default, the Font Awesome’s `fa-external-link-square-alt` icon is used,
63
+ which requires your site to have Font Awesome initialized.
64
+
65
+ You can set `marker_html` to empty string and style links with a custom CSS rule
31
66
  (e.g., `a[rel=external] { border-bottom-style: dashed; }`), though it’s less flexible.
32
67
 
68
+ ### `external_links.ignored_selectors`
69
+
70
+ Even if a link matches `selector`, it won’t be altered if it also matches any of these
71
+ selectors.
72
+
73
+ ### `url`
74
+
75
+ The `url` option in your Jekyll configuration is used when deciding
76
+ whether a given link is external or not. If not specified,
77
+ only domain-relative links are considered internal.
78
+
33
79
  ## Example site
34
80
 
35
81
  An example site is included in this repo.
@@ -37,7 +83,22 @@ Use it to demo the plugin and to test it during development.
37
83
  The `/` path leads to Markdown version, the `/asciidoc/` path leads to AsciiDoc version.
38
84
 
39
85
  1. Clone this repository
40
- 2. Navigate into the example-project directory
86
+ 2. Navigate into the example-site directory
41
87
  3. Run `bundle`
42
88
  4. Run `bundle exec jekyll serve`
43
89
  5. Open in your favorite browser the URL shown
90
+
91
+ Note that, due to the fact that gem lockfiles are platform-specific,
92
+ it may not work out of the box.
93
+
94
+ The example site build may output deprecation warnings
95
+ coming from the default Minima theme
96
+ not being fully compatible with the latest Jekyll/SASS stack.
97
+
98
+ ## Contribution
99
+
100
+ Contributions are welcome.
101
+
102
+ It’s appreciated if you also update the bundled example site to illustrate
103
+ the changes in your PR. The example site adds the plugin via a relative path,
104
+ and any changes you make to plugin code will take effect on next rebuild.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'jekyll-external-links'
5
- s.version = '1.0.0'
5
+ s.version = '1.0.2'
6
6
  s.authors = ['Ribose Inc.']
7
7
  s.email = ['open.source@ribose.com']
8
8
 
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(example-site|test|spec|features)/!) }
14
14
 
15
15
  s.add_runtime_dependency 'jekyll', '~> 4.0'
16
- s.add_runtime_dependency 'nokogiri'
16
+ s.add_runtime_dependency 'nokogiri', '~> 1.0'
17
17
  s.add_development_dependency 'rake', '~> 12.0'
18
18
  s.add_development_dependency 'rubocop', '~> 0.50'
19
19
 
@@ -42,8 +42,11 @@ def mark_links_in_page_or_document(page_or_document)
42
42
  'a[href*=coverity]',
43
43
  'a[href*=codecov]',
44
44
  ]
45
-
46
- unless page_or_document.respond_to?(:asset_file?) and page_or_document.asset_file?
45
+
46
+ # Do not process assets or other non-HTML files
47
+ unless (page_or_document.respond_to?(:asset_file?) and
48
+ page_or_document.asset_file?) or
49
+ page_or_document.output_ext != ".html"
47
50
  page_or_document.output = process_content(
48
51
  site_hostname,
49
52
  page_or_document.output,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-external-links
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-16 00:00:00.000000000 Z
11
+ date: 2023-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.50'
69
- description:
69
+ description:
70
70
  email:
71
71
  - open.source@ribose.com
72
72
  executables: []
@@ -84,7 +84,7 @@ homepage: https://github.com/riboseinc/jekyll-external-links/
84
84
  licenses:
85
85
  - MIT
86
86
  metadata: {}
87
- post_install_message:
87
+ post_install_message:
88
88
  rdoc_options: []
89
89
  require_paths:
90
90
  - lib
@@ -99,8 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubygems_version: 3.0.3
103
- signing_key:
102
+ rubygems_version: 3.3.26
103
+ signing_key:
104
104
  specification_version: 4
105
105
  summary: Jekyll plugin that marks external links in your site
106
106
  test_files: []