jekyll-spaceship 0.7.0 → 0.7.1
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 +4 -4
- data/README.md +50 -6
- data/lib/jekyll-spaceship/cores/config.rb +6 -2
- data/lib/jekyll-spaceship/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38acd43c5d713728eb8beefc21a41ccff0404503138429c5fc695d5a92b0fbb5
|
4
|
+
data.tar.gz: aa0e6b588b3f778ef332ec83604ba26a3d238de34bfb458a7f85d1c3b006c0f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53ad3ff1458d8b5a1cde457ec7fa34672680f334fddb1613ebec356a461f0c7217faea14e361f0e022b3dceb7789d0ff7fa5d069d95c190343008d9485630f76
|
7
|
+
data.tar.gz: 97606894a42e2fa2fc34e66fb9b3cbb6013587696ed70bf8153a9b5bd2cf81f6444ee9337d13d672f3c3afe3c504039fd754b51deee9324c3df6287bee7c6b53
|
data/README.md
CHANGED
@@ -760,8 +760,8 @@ See the [Gemoji](https://github.com/github/gemoji) documentation for generating
|
|
760
760
|
### 8. Modifying Element Usage
|
761
761
|
|
762
762
|
It allows us to modify elements via `CSS3 selectors`. Through it you can easily
|
763
|
-
modify the attributes of
|
764
|
-
very flexible, but here is example usage for modifying a document:
|
763
|
+
modify the attributes of an element tag, replace the children nodes and so on,
|
764
|
+
it's very flexible, but here is example usage for modifying a document:
|
765
765
|
|
766
766
|
```yml
|
767
767
|
# Here is a comprehensive example
|
@@ -774,7 +774,7 @@ jekyll-spaceship:
|
|
774
774
|
props: # Replace element properties
|
775
775
|
title: Good image # Add a title attribute
|
776
776
|
src: ['(^.*$)', '\0?a=123'] # Add query string to src attribute by regex pattern
|
777
|
-
style: # Add style attribute (
|
777
|
+
style: # Add style attribute (Hash Style)
|
778
778
|
color: red
|
779
779
|
font-size: '1.2em'
|
780
780
|
children: # Add children to the element
|
@@ -789,18 +789,60 @@ jekyll-spaceship:
|
|
789
789
|
children: # Add nested chidren nodes
|
790
790
|
- "<span>Jekyll</span>" # First child node (String Style)
|
791
791
|
- name: span # Second child node (Hash Style)
|
792
|
-
props: #
|
792
|
+
props: # Add attributes to child node (Hash Style)
|
793
793
|
prop1: "a"
|
794
794
|
prop2: "b"
|
795
795
|
prop3: "c"
|
796
796
|
children: "<b>Yap!</b>" # Add children nodes (String Style)
|
797
797
|
- # Last empty for adding before the first child node
|
798
798
|
- a.link: '<a href="//t.com">Link</a>' # Replace all `a.link` tags (String Style)
|
799
|
-
- h1#title:
|
799
|
+
- 'h1#title': # Replace `h1#title` tags (Hash Style)
|
800
800
|
children: I'm a title! # Replace inner html to new text
|
801
|
-
|
802
801
|
```
|
803
802
|
|
803
|
+
#### Example 1
|
804
|
+
|
805
|
+
Automatically adds a `target="_blank" rel="noopener noreferrer"` attribute to all external links in Jekyll's content.
|
806
|
+
|
807
|
+
```yml
|
808
|
+
jekyll-spaceship:
|
809
|
+
element-processor:
|
810
|
+
css:
|
811
|
+
- a: # Replce all `a` tags
|
812
|
+
props:
|
813
|
+
class: ['(^.*$)', '\0 ext-link'] # Add `ext-link` to class by regex pattern
|
814
|
+
target: _blank # Replace `target` value to `_blank`
|
815
|
+
rel: noopener noreferrer # Replace `rel` value to `noopener noreferrer`
|
816
|
+
```
|
817
|
+
|
818
|
+
#### Example 2
|
819
|
+
|
820
|
+
Automatically adds `loading="lazy"` to `img` and `iframe` tags to natively load lazily.
|
821
|
+
[Browser support](https://caniuse.com/#feat=loading-lazy-attr) is growing. If a browser does not support the `loading` attribute, it will load the resource just like it would normally.
|
822
|
+
|
823
|
+
```yml
|
824
|
+
jekyll-spaceship:
|
825
|
+
element-processor:
|
826
|
+
css:
|
827
|
+
- a: # Replce all `a` tags
|
828
|
+
props: #
|
829
|
+
loading: lazy # Replace `lading` value to `lazy`
|
830
|
+
```
|
831
|
+
|
832
|
+
In case you want to prevent loading some images/iframes lazily, add
|
833
|
+
`loading="eager"` to their tags. This might be useful to prevent flickering of
|
834
|
+
images during navigation (e.g. the site's logo).
|
835
|
+
|
836
|
+
See the following examples to prevent lazy loading.
|
837
|
+
|
838
|
+
```yml
|
839
|
+
jekyll-spaceship:
|
840
|
+
element-processor:
|
841
|
+
css:
|
842
|
+
- a: # Replce all `a` tags
|
843
|
+
props: #
|
844
|
+
loading: eager # Replace `loading` value to `eager`
|
845
|
+
```
|
804
846
|
|
805
847
|
|
806
848
|
## Credits
|
@@ -809,6 +851,8 @@ jekyll-spaceship:
|
|
809
851
|
- [MultiMarkdown](https://fletcher.github.io/MultiMarkdown-6) - Lightweight markup processor to produce HTML, LaTeX, and more.
|
810
852
|
- [markdown-it-multimd-table](https://github.com/RedBug312/markdown-it-multimd-table) - Multimarkdown table syntax plugin for markdown-it markdown parser.
|
811
853
|
- [jmoji](https://github.com/jekyll/jemoji) - GitHub-flavored emoji plugin for Jekyll.
|
854
|
+
- [jekyll-target-blank](https://github.com/keithmifsud/jekyll-target-blank) - Automatically opens external links in a new browser for Jekyll Pages, Posts and Docs.
|
855
|
+
- [jekyll-loading-lazy](https://github.com/gildesmarais/jekyll-loading-lazy) - Automatically adds loading="lazy" to img and iframe tags to natively load lazily.
|
812
856
|
|
813
857
|
## Contributing
|
814
858
|
|
@@ -38,10 +38,10 @@ module Jekyll::Spaceship
|
|
38
38
|
@@store[section] = deep_merge(default, @@store[section])
|
39
39
|
end
|
40
40
|
|
41
|
-
def self.load(
|
41
|
+
def self.load(config = self.site_config)
|
42
42
|
config = deep_merge(
|
43
43
|
{ CONFIG_NAME => DEFAULT_CONFIG },
|
44
|
-
|
44
|
+
config
|
45
45
|
)[CONFIG_NAME]
|
46
46
|
@@store = config
|
47
47
|
self.use_processors(config)
|
@@ -52,5 +52,9 @@ module Jekyll::Spaceship
|
|
52
52
|
Register.use processor
|
53
53
|
end
|
54
54
|
end
|
55
|
+
|
56
|
+
def self.site_config
|
57
|
+
Jekyll.sites.first.config
|
58
|
+
end
|
55
59
|
end
|
56
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-spaceship
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jeffreytse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|