jekyll_picture_tag 1.7.0 → 1.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.solargraph.yml +15 -0
- data/.travis.yml +4 -7
- data/Dockerfile +9 -0
- data/docs/Gemfile +4 -0
- data/docs/Gemfile.lock +249 -0
- data/docs/_config.yml +13 -0
- data/docs/_layouts/directory.html +32 -0
- data/docs/assets/style.css +31 -0
- data/{contributing.md → docs/contributing.md} +57 -15
- data/docs/{examples/_data/picture.yml → example_presets.md} +36 -25
- data/docs/global_configuration.md +61 -3
- data/docs/index.md +114 -0
- data/docs/installation.md +36 -21
- data/docs/migration.md +4 -0
- data/docs/notes.md +64 -58
- data/docs/output.md +63 -0
- data/docs/presets.md +175 -221
- data/docs/releases.md +64 -0
- data/docs/usage.md +91 -79
- data/jekyll_picture_tag.gemspec +3 -1
- data/lib/jekyll_picture_tag.rb +27 -10
- data/lib/jekyll_picture_tag/defaults/global.yml +2 -0
- data/lib/jekyll_picture_tag/defaults/presets.yml +2 -0
- data/lib/jekyll_picture_tag/generated_image.rb +105 -19
- data/lib/jekyll_picture_tag/instructions.rb +1 -0
- data/lib/jekyll_picture_tag/instructions/arg_splitter.rb +68 -0
- data/lib/jekyll_picture_tag/instructions/configuration.rb +47 -11
- data/lib/jekyll_picture_tag/instructions/html_attributes.rb +14 -8
- data/lib/jekyll_picture_tag/instructions/preset.rb +34 -14
- data/lib/jekyll_picture_tag/instructions/set.rb +18 -8
- data/lib/jekyll_picture_tag/instructions/tag_parser.rb +59 -69
- data/lib/jekyll_picture_tag/output_formats/basic.rb +35 -6
- data/lib/jekyll_picture_tag/output_formats/data_attributes.rb +4 -1
- data/lib/jekyll_picture_tag/router.rb +16 -0
- data/lib/jekyll_picture_tag/source_image.rb +6 -1
- data/lib/jekyll_picture_tag/srcsets/basic.rb +45 -19
- data/lib/jekyll_picture_tag/srcsets/pixel_ratio.rb +1 -3
- data/lib/jekyll_picture_tag/srcsets/width.rb +1 -1
- data/lib/jekyll_picture_tag/utils.rb +18 -0
- data/lib/jekyll_picture_tag/version.rb +1 -1
- data/readme.md +43 -200
- metadata +49 -13
- data/docs/examples/_config.yml +0 -10
- data/docs/examples/post.md +0 -46
- data/docs/readme.md +0 -23
data/docs/output.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
|
4
|
+
# Output Formats
|
5
|
+
|
6
|
+
This is a listing of the various text arrangements that JPT can give you. Select one by setting
|
7
|
+
`markup:` in the relevant [markup preset]({{ site.baseurl }}/presets).
|
8
|
+
|
9
|
+
Example:
|
10
|
+
|
11
|
+
```yml
|
12
|
+
# /_data/picture.yml
|
13
|
+
|
14
|
+
markup_presets:
|
15
|
+
my_preset:
|
16
|
+
markup: data_auto
|
17
|
+
```
|
18
|
+
|
19
|
+
## Standard HTML:
|
20
|
+
|
21
|
+
- **`picture`:** `<picture>` element surrounding a `<source>` tag for each required srcset, and a
|
22
|
+
fallback `<img>`.
|
23
|
+
|
24
|
+
- **`img`:** output a single `<img>` tag with a `srcset` entry.
|
25
|
+
|
26
|
+
- **`auto`:** Supply an img tag when you have only one srcset, otherwise supply a picture tag.
|
27
|
+
|
28
|
+
## Javascript Friendly:
|
29
|
+
|
30
|
+
- **`data_picture`, `data_img`, `data_auto`:** Analogous to their counterparts above, but instead of
|
31
|
+
`src`, `srcset`, and `sizes`, you get `data-src`, `data-srcset`, and `data-sizes`. This allows you
|
32
|
+
to use javascript for things like [lazy loading](https://github.com/verlok/lazyload).
|
33
|
+
|
34
|
+
#### Special Options
|
35
|
+
|
36
|
+
The following preset configuration settings only apply to the `data_` output formats.
|
37
|
+
|
38
|
+
- **noscript**
|
39
|
+
|
40
|
+
_Format:_ `noscript: true|false`
|
41
|
+
|
42
|
+
_Default:_ `false`
|
43
|
+
|
44
|
+
Include a basic `img` fallback within a `<noscript>` tag, giving your javascript-disabled users
|
45
|
+
something to look at.
|
46
|
+
|
47
|
+
- **data_sizes**
|
48
|
+
|
49
|
+
_Format:_ `data_sizes: true|false`
|
50
|
+
|
51
|
+
_Default:_ `true`
|
52
|
+
|
53
|
+
This option sets whether you would like JPT's auto-generated sizes to be returned as a
|
54
|
+
`data-sizes` attribute or a normal `sizes` attribute. (Useful for interfacing nicely with all the
|
55
|
+
various JS image libraries out there.)
|
56
|
+
|
57
|
+
## Fragments:
|
58
|
+
|
59
|
+
- **`direct_url`**: Generates an image and returns only its url. Uses `fallback_` properties (width
|
60
|
+
and format).
|
61
|
+
|
62
|
+
- **`naked_srcset`**: Builds a srcset and nothing else (not even the surrounding quotes). Note that the
|
63
|
+
(image) `format` setting must still be an array, even if you only give it one value.
|
data/docs/presets.md
CHANGED
@@ -1,110 +1,62 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
|
1
4
|
# Writing Presets
|
2
5
|
|
3
|
-
Presets are
|
4
|
-
|
6
|
+
Presets are named collections of settings that determine basically everything about JPT's output.
|
7
|
+
They are stored in `_data/picture.yml`, to avoid cluttering `_config.yml`. You will have to create
|
8
|
+
this file, and probably the `_data/` directory as well.
|
5
9
|
|
6
|
-
|
10
|
+
Here's an [example data file]({{ site.baseurl }}/example_presets).
|
7
11
|
|
8
|
-
|
12
|
+
Any settings which are specific to particular output formats are documented on the [output
|
13
|
+
formats]({{site.baseurl}}/output) page.
|
9
14
|
|
10
|
-
|
11
|
-
Picture tag is basically a programmatic implementation of the [MDN Responsive Images
|
12
|
-
guide](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images).
|
15
|
+
## Required Knowledge
|
13
16
|
|
14
|
-
If you don't know the difference between resolution switching and art direction, stop now and read
|
17
|
+
If you don't know the difference between resolution switching and art direction, stop now and read
|
18
|
+
the [MDN Responsive Images
|
19
|
+
guide](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images)
|
15
20
|
in detail. Ideally, play around with a basic HTML file, a few test images, and a few different
|
16
21
|
browser widths until you understand it.
|
17
22
|
|
18
|
-
## Example settings
|
19
|
-
|
20
|
-
A more thorough example can be found under `docs/examples/_data/picture.yml`.
|
21
|
-
|
22
|
-
```yml
|
23
|
-
|
24
|
-
# _data/picture.yml
|
25
|
-
|
26
|
-
media_presets:
|
27
|
-
wide_desktop: 'min-width: 1801px'
|
28
|
-
desktop: 'max-width: 1800px'
|
29
|
-
wide_tablet: 'max-width: 1200px'
|
30
|
-
tablet: 'max-width: 900px'
|
31
|
-
mobile: 'max-width: 600px'
|
32
|
-
|
33
|
-
markup_presets:
|
34
|
-
default:
|
35
|
-
formats: [webp, original]
|
36
|
-
widths: [200, 400, 800, 1600]
|
37
|
-
media_widths:
|
38
|
-
mobile: [200, 400, 600]
|
39
|
-
tablet: [400, 600, 800]
|
40
|
-
size: 800px
|
41
|
-
sizes:
|
42
|
-
mobile: 100vw
|
43
|
-
desktop: 60vw
|
44
|
-
attributes:
|
45
|
-
picture: 'class="awesome" data-volume="11"'
|
46
|
-
img: 'class="some-other-class"'
|
47
|
-
|
48
|
-
icon:
|
49
|
-
base-width: 20
|
50
|
-
pixel_ratios: [1, 1.5, 2]
|
51
|
-
|
52
|
-
lazy:
|
53
|
-
markup: data_auto
|
54
|
-
formats: [webp, original]
|
55
|
-
widths: [200, 400, 600, 800]
|
56
|
-
noscript: true
|
57
|
-
attributes:
|
58
|
-
img: class="lazy"
|
59
|
-
|
60
|
-
```
|
61
|
-
|
62
23
|
## Media Presets
|
63
24
|
|
64
|
-
|
25
|
+
_Format:_
|
65
26
|
|
66
27
|
```yml
|
67
28
|
media_presets:
|
68
|
-
(name): (css media query)
|
69
29
|
(name): (css media query)
|
70
30
|
(name): (css media query)
|
71
31
|
(...)
|
72
32
|
|
73
33
|
```
|
74
34
|
|
75
|
-
|
35
|
+
_Example:_
|
76
36
|
|
77
37
|
```yml
|
78
38
|
media_presets:
|
79
|
-
desktop:
|
39
|
+
desktop: "min-width: 1200px"
|
80
40
|
```
|
81
41
|
|
82
|
-
These are named media queries for use in a few different places
|
83
|
-
|
84
|
-
|
85
|
-
These are used for specifying alternate source images in your liquid tag, and for building the
|
86
|
-
'sizes' attribute within your presets. Quotes are required around the media
|
87
|
-
queries, because yml gets confused by free colons.
|
42
|
+
These are named media queries for use in a few different places: specifying alternate source images
|
43
|
+
in your liquid tag, building the 'sizes' attribute within your presets, and in a few configuration
|
44
|
+
settings. Quotes are recommended around the media queries, because yml gets confused by colons.
|
88
45
|
|
89
46
|
## Markup Presets
|
90
47
|
|
91
|
-
|
48
|
+
_Format:_
|
92
49
|
|
93
50
|
```yml
|
94
51
|
markup_presets:
|
95
52
|
(name):
|
96
|
-
(option): (setting)
|
97
|
-
(option): (setting)
|
98
|
-
(option): (setting)
|
99
|
-
(...)
|
100
|
-
(another name):
|
101
|
-
(option): (setting)
|
102
53
|
(option): (setting)
|
103
54
|
(option): (setting)
|
104
55
|
(...)
|
56
|
+
(...)
|
105
57
|
```
|
106
58
|
|
107
|
-
|
59
|
+
_Example:_
|
108
60
|
|
109
61
|
```yml
|
110
62
|
markup_presets:
|
@@ -119,73 +71,41 @@ markup_presets:
|
|
119
71
|
noscript: true
|
120
72
|
```
|
121
73
|
|
122
|
-
|
123
|
-
|
124
|
-
can select one as the first argument given to the tag:
|
74
|
+
Each entry is a pre-defined collection of settings to build a given chunk of text (usually HTML) and
|
75
|
+
its respective images. You can select one as the first argument given to the tag:
|
125
76
|
|
77
|
+
{% raw %}
|
126
78
|
`{% picture my-preset image.jpg %}`
|
79
|
+
{% endraw %}
|
127
80
|
|
128
|
-
The `default` preset will be used if none is specified. A preset name can't contain
|
129
|
-
or `/` characters.
|
81
|
+
The `default` preset will be used if none is specified. A preset name can't contain a `.` (period).
|
130
82
|
|
131
|
-
#### A Note on srcsets
|
83
|
+
#### A Note on srcsets
|
132
84
|
|
133
|
-
|
85
|
+
For images that are different sizes on different screens (most images), use a width-based srcset
|
86
|
+
(which is the default). Specify a `widths` setting (or don't, for the default set), and optionally
|
87
|
+
the `sizes` and `size` settings.
|
134
88
|
|
135
|
-
|
136
|
-
|
137
|
-
device's pixel ratio, so in combination with the sizes attribute (if given, otherwise it assumes the
|
138
|
-
image will be 100vw) they can select the best-fitting image for the space it will fill on the screen. This is generally the one you want to use.
|
89
|
+
Use a multiplier-based srcset when the image will always be the same size, regardless of screen
|
90
|
+
width (thumbnails and icons). To use a multiplier-based srcset, set `pixel_ratios` and `base_width`.
|
139
91
|
|
140
|
-
|
141
|
-
browser is less smart here; it looks at its own device's pixel ratio, compares it to the given
|
142
|
-
multiplier, and picks the closest one. It doesn't consider anything else at all. Multiplier based
|
143
|
-
srcsets are best used when the image will always be the same size, on all screen sizes.
|
92
|
+
### Settings reference
|
144
93
|
|
145
|
-
|
146
|
-
optionally the `sizes` and `size` settings.
|
94
|
+
- **Markup format**
|
147
95
|
|
148
|
-
|
96
|
+
_Format:_ `markup: (setting)`
|
149
97
|
|
150
|
-
|
98
|
+
_Default_: `auto`
|
151
99
|
|
152
|
-
|
100
|
+
Defines what format the generated text will take. They are documented [here]({{ site.baseurl }}/output).
|
153
101
|
|
154
|
-
*Format:* `markup: (setting)`
|
155
|
-
|
156
|
-
*Default*: `auto`
|
157
|
-
|
158
|
-
Defines what format the generated HTML will take. Here are your options:
|
159
|
-
|
160
|
-
* `picture`: `<picture>` element surrounding a `<source>` tag for each required srcset, and a
|
161
|
-
fallback `<img>`.
|
162
|
-
* `img`: output a single `<img>` tag with a `srcset` entry.
|
163
|
-
* `auto`: Supply an img tag when you have only one srcset, otherwise supply a picture tag.
|
164
|
-
* `data_picture`, `data_img`, `data_auto`: Analogous to their counterparts,
|
165
|
-
but instead of `src`, `srcset`, and `sizes`, you get `data-src`, `data-srcset`, and
|
166
|
-
`data-sizes`. This allows you to use javascript for things like [lazy loading](https://github.com/verlok/lazyload)
|
167
|
-
* `direct_url`: Generates an image and returns only its url. Uses `fallback_` properties (width
|
168
|
-
and format)
|
169
|
-
* `naked_srcset`: Builds a srcset and nothing else (not even the surrounding quotes). Useful with
|
170
|
-
libraries requiring more complex or customized markup. Note that the (image) `format` setting
|
171
|
-
must still be an array, even if you can only give it one value.
|
172
|
-
|
173
102
|
* **Image Formats**
|
174
103
|
|
175
|
-
|
104
|
+
_Format:_ `format: [format1, format2, (...)]`
|
176
105
|
|
177
|
-
|
106
|
+
_Example:_ `format: [webp, original]`
|
178
107
|
|
179
|
-
|
180
|
-
|
181
|
-
*Supported formats are anything which imagemagick supports, including the
|
182
|
-
following:*
|
183
|
-
* jpg/jpeg
|
184
|
-
* png
|
185
|
-
* gif
|
186
|
-
* webp
|
187
|
-
* jxr
|
188
|
-
* jp2
|
108
|
+
_Default_: `original`
|
189
109
|
|
190
110
|
Array (yml sequence) of the image formats you'd like to generate, in decreasing order of
|
191
111
|
preference. Browsers will render the first format they find and understand, so **If you put jpg
|
@@ -193,106 +113,84 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
193
113
|
webp, you must have an imagemagick webp delegate installed. (Most package managers just name it
|
194
114
|
'webp')
|
195
115
|
|
196
|
-
|
116
|
+
_Supported formats are anything which imagemagick supports, and has an installed delegate. See a
|
117
|
+
list by running `$ convert --version`_
|
118
|
+
|
119
|
+
* **Widths**
|
197
120
|
|
198
|
-
|
121
|
+
_Format:_ `widths: [integer, integer, (...)]`
|
199
122
|
|
200
|
-
|
123
|
+
_Example:_ `widths: [600, 800, 1200]`
|
201
124
|
|
202
|
-
|
125
|
+
_Default_: `[400, 600, 800, 1000]`
|
203
126
|
|
204
|
-
Array of image widths to generate, in pixels. For use when you want a
|
127
|
+
Array of image widths to generate, in pixels. For use when you want a width-based srcset
|
205
128
|
(`srcset="img.jpg 800w, img2.jpg 1600w"`).
|
206
129
|
|
207
|
-
* **
|
130
|
+
* **Media_widths**
|
208
131
|
|
209
|
-
|
132
|
+
_Format:_
|
210
133
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
134
|
+
```yml
|
135
|
+
media_widths:
|
136
|
+
(media preset name): [integer, integer, (...)]
|
137
|
+
```
|
215
138
|
|
216
|
-
|
139
|
+
_Example:_
|
217
140
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
141
|
+
```yml
|
142
|
+
media_widths:
|
143
|
+
mobile: [400, 600, 800]
|
144
|
+
```
|
222
145
|
|
223
|
-
|
146
|
+
_Default:_ Widths setting
|
224
147
|
|
225
148
|
If you are using art direction, there is no sense in generating desktop-size files for your mobile
|
226
149
|
image. You can specify sets of widths to associate with given media queries. If not specified,
|
227
150
|
will use `widths` setting.
|
228
151
|
|
229
|
-
* **
|
230
|
-
|
231
|
-
*Format:* `fallback_width: (integer)`
|
232
|
-
|
233
|
-
*Example:* `fallback_width: 800`
|
234
|
-
|
235
|
-
*Default*: `800`
|
236
|
-
|
237
|
-
Width of the fallback image.
|
238
|
-
|
239
|
-
* **Fallback Image**
|
240
|
-
|
241
|
-
*Format:* `fallback_format: (format)`
|
242
|
-
|
243
|
-
*Example:* `fallback_format: jpg`
|
152
|
+
* **Sizes**
|
244
153
|
|
245
|
-
|
154
|
+
_Format:_
|
246
155
|
|
247
|
-
|
156
|
+
```yml
|
157
|
+
sizes:
|
158
|
+
(media preset): (CSS dimension)
|
159
|
+
(...)
|
160
|
+
```
|
248
161
|
|
249
|
-
|
162
|
+
_Example:_
|
250
163
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
(...)
|
258
|
-
```
|
259
|
-
|
260
|
-
*Example:*
|
261
|
-
```yml
|
262
|
-
sizes:
|
263
|
-
mobile: 80vw
|
264
|
-
tablet: 60vw
|
265
|
-
desktop: 900px
|
266
|
-
```
|
164
|
+
```yml
|
165
|
+
sizes:
|
166
|
+
mobile: 80vw
|
167
|
+
tablet: 60vw
|
168
|
+
desktop: 900px
|
169
|
+
```
|
267
170
|
|
268
171
|
Conditional sizes, used to construct the `sizes=` HTML attribute telling the browser how wide your
|
269
172
|
image will be (on the screen) when a given media query is true. CSS dimensions can be given in
|
270
|
-
`px`, `em`, or `vw`. To be used along with a width
|
173
|
+
`px`, `em`, or `vw`. To be used along with a width-based srcset.
|
271
174
|
|
272
|
-
Provide these in order of most restrictive to least restrictive. The browser will choose the
|
175
|
+
Provide these in order of most restrictive to least restrictive. The browser will choose the
|
273
176
|
first one with an applicable media query.
|
274
177
|
|
275
178
|
You don't have to provide a sizes attribute at all. If you don't, the browser will assume the
|
276
179
|
image is 100% the width of the viewport.
|
277
180
|
|
278
|
-
The same sizes attribute is used for every source tag in a given picture tag. This causes some
|
279
|
-
redundant markup, specifying sizes for situations when an image will never be rendered, but it
|
280
|
-
keeps things a bit simpler.
|
281
|
-
|
282
181
|
* **Size**
|
283
182
|
|
284
|
-
|
183
|
+
_Format:_ `size: (CSS Dimension)`
|
285
184
|
|
286
|
-
|
185
|
+
_Example:_ `size: 80vw`
|
287
186
|
|
288
|
-
Unconditional
|
289
|
-
either alone or after all conditional sizes.
|
187
|
+
Unconditional `sizes` setting, to be supplied either alone or after all conditional sizes.
|
290
188
|
|
291
189
|
* **Pixel Ratios**
|
292
190
|
|
293
|
-
|
191
|
+
_Format:_ `pixel_ratios: [number, number, number (...)]`
|
294
192
|
|
295
|
-
|
193
|
+
_Example:_ `pixel_ratios: [1, 1.5, 2]`
|
296
194
|
|
297
195
|
Array of images to construct, given in multiples of the base width. If you set this, you must also
|
298
196
|
give a `base_width`.
|
@@ -301,36 +199,87 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
301
199
|
|
302
200
|
* **Base Width**
|
303
201
|
|
304
|
-
|
202
|
+
_Format:_ `base_width: integer`
|
305
203
|
|
306
|
-
|
204
|
+
_Example:_ `base_width: 100`
|
307
205
|
|
308
206
|
When using pixel ratios, you must supply a base width. This sets how wide the 1x image should be.
|
309
207
|
|
208
|
+
* **Crop & Media Crop**
|
209
|
+
|
210
|
+
_Format:_
|
211
|
+
|
212
|
+
```yml
|
213
|
+
crop: (geometery)
|
214
|
+
media_crop:
|
215
|
+
(media_preset): (geometry)
|
216
|
+
(media_preset): (geometry)
|
217
|
+
(...)
|
218
|
+
```
|
219
|
+
|
220
|
+
_Example:_
|
221
|
+
|
222
|
+
```yml
|
223
|
+
crop: 16:9
|
224
|
+
media_crop:
|
225
|
+
tablet: 3:2
|
226
|
+
mobile: 1:1
|
227
|
+
```
|
228
|
+
|
229
|
+
**Check the [ installation guide ](installation) before using this feature.**
|
230
|
+
|
231
|
+
Crop geometry, given either generally or for specific media presets. The hierarchy is:
|
232
|
+
`tag argument` > `media_crop:` > `crop:`.
|
233
|
+
|
234
|
+
This setting accepts the same arguments as the `crop geometry` [tag parameter](usage).
|
235
|
+
|
236
|
+
|
237
|
+
* **Gravity & Media_gravity**
|
238
|
+
|
239
|
+
```yml
|
240
|
+
crop: (gravity)
|
241
|
+
media_crop:
|
242
|
+
(media_preset): (gravity)
|
243
|
+
(media_preset): (gravity)
|
244
|
+
(...)
|
245
|
+
```
|
246
|
+
|
247
|
+
_Example:_
|
248
|
+
|
249
|
+
```yml
|
250
|
+
crop: north
|
251
|
+
media_crop:
|
252
|
+
tablet: east
|
253
|
+
mobile: southwest
|
254
|
+
```
|
255
|
+
|
256
|
+
Crop gravity, given either generally or for specific media presets. The hierarchy is:
|
257
|
+
`tag argument` > `media_crop:` > `crop:` > `center` (default).
|
258
|
+
|
259
|
+
This setting accepts the same arguments as the `crop gravity` [tag parameter](usage).
|
260
|
+
|
310
261
|
* **Quality**
|
311
262
|
|
312
|
-
|
263
|
+
_Format:_ `quality: 0 <= integer <= 100`
|
313
264
|
|
314
|
-
|
265
|
+
_Example:_ `quality: 80`
|
315
266
|
|
316
|
-
|
267
|
+
_Default:_ `75`
|
317
268
|
|
318
269
|
This allows you to specify an image compression level for all image formats (where it makes sense,
|
319
270
|
anyway). The next option allows you to set them per format.
|
320
271
|
|
321
272
|
* **Format Quality**
|
322
273
|
|
323
|
-
|
274
|
+
_Format:_
|
324
275
|
|
325
276
|
```yml
|
326
277
|
format_quality:
|
327
|
-
(format): integer <= 100
|
328
|
-
(format): integer <= 100
|
329
|
-
(format): integer <= 100
|
278
|
+
(format): 0 <= integer <= 100
|
330
279
|
(...)
|
331
280
|
```
|
332
281
|
|
333
|
-
|
282
|
+
_Example:_
|
334
283
|
|
335
284
|
```
|
336
285
|
format_quality:
|
@@ -339,26 +288,24 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
339
288
|
webp: 55
|
340
289
|
```
|
341
290
|
|
342
|
-
|
291
|
+
_Default:_ quality setting (above)
|
343
292
|
|
344
293
|
This allows you to specify quality settings for various image formats, allowing you to take
|
345
294
|
advantage of webp's better compression algorithm without trashing your jpg images (for example).
|
346
295
|
If you don't give a setting for a particular format it'll fall back to the `quality` setting
|
347
|
-
above, and if you don't set
|
296
|
+
above, and if you don't set _that_ it'll default to 75.
|
348
297
|
|
349
298
|
* **HTML Attributes**
|
350
299
|
|
351
|
-
|
300
|
+
_Format:_
|
352
301
|
|
353
302
|
```yml
|
354
303
|
attributes:
|
355
|
-
(element): '(attributes)'
|
356
|
-
(element): '(attributes)'
|
357
304
|
(element): '(attributes)'
|
358
305
|
(...)
|
359
306
|
```
|
360
307
|
|
361
|
-
|
308
|
+
_Example:_
|
362
309
|
|
363
310
|
```yml
|
364
311
|
attributes:
|
@@ -366,42 +313,49 @@ To use a multiplier based srcset, set `pixel_ratios` and `base_width`.
|
|
366
313
|
picture: 'class="even-cooler"'
|
367
314
|
```
|
368
315
|
|
369
|
-
HTML attributes you would like to add.
|
370
|
-
tag
|
371
|
-
yml, so it's recommended to surround them with single quotes.
|
316
|
+
HTML attributes you would like to add. The same arguments are available here as in the liquid
|
317
|
+
tag: HTML element names, `alt:`, `link:`, and `parent:`. Unescaped double quotes cause problems
|
318
|
+
with yml, so it's recommended to surround them with single quotes.
|
319
|
+
|
320
|
+
* **Fallback Width**
|
321
|
+
|
322
|
+
_Format:_ `fallback_width: (integer)`
|
372
323
|
|
373
|
-
|
324
|
+
_Example:_ `fallback_width: 800`
|
374
325
|
|
375
|
-
|
326
|
+
_Default_: `800`
|
376
327
|
|
377
|
-
|
328
|
+
Width of the fallback image.
|
378
329
|
|
379
|
-
|
330
|
+
* **Fallback Format**
|
380
331
|
|
381
|
-
|
382
|
-
`<noscript>` tag after the standard html. This allows you to use lazy loading or other javascript
|
383
|
-
image tools, without breaking all of your images for non-javascript-enabled users.
|
332
|
+
_Format:_ `fallback_format: (format)`
|
384
333
|
|
385
|
-
|
334
|
+
_Example:_ `fallback_format: jpg`
|
386
335
|
|
387
|
-
|
336
|
+
_Default_: `original`
|
388
337
|
|
389
|
-
|
338
|
+
Format of the fallback image
|
390
339
|
|
391
|
-
|
340
|
+
* **Source Image Link**
|
341
|
+
|
342
|
+
_Format:_ `link_source: (true|false)`
|
343
|
+
|
344
|
+
_Example:_ `link_source: true`
|
345
|
+
|
346
|
+
_Default:_ `false`
|
392
347
|
|
393
348
|
Surround image with a link to the original source file. Your source image directory must be
|
394
349
|
published as part of the compiled site. If you run into weird issues with the output, see
|
395
|
-
[notes](notes
|
350
|
+
the [notes]({{ site.baseurl }}/notes).
|
396
351
|
|
397
352
|
* **Nomarkdown override**
|
398
|
-
|
399
|
-
*Format:* `nomarkdown: (true|false)`
|
400
353
|
|
401
|
-
|
354
|
+
_Format:_ `nomarkdown: (true|false)`
|
402
355
|
|
403
|
-
|
356
|
+
_Example:_ `nomarkdown: false`
|
404
357
|
|
405
|
-
|
406
|
-
`_config.yml`. See [notes](notes.md) for a detailed explanation.
|
358
|
+
_Default:_ `nil`
|
407
359
|
|
360
|
+
Hard setting for `{::nomarkdown}` tags, overrides both autodetection and the global setting in
|
361
|
+
`_config.yml`. See the [notes]({{ site.baseurl }}/notes) for a detailed explanation.
|