Skip to content

Commit 74cbf2a

Browse files
committed
Update docs
1 parent 0a6ab76 commit 74cbf2a

34 files changed

+1045
-244
lines changed

CHANGELOG

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
mkdocs-glightbox-0.3.0 (2022-09-29)
2+
3+
* Fixed width and height setting in config not working bug
4+
* Supported specific skip class (#5)
5+
* Supported glightbox built-in caption with title and description (#4)
6+
* Fixed page jitter when lightbox closing issue using Material for MkDocs
7+
* Add white background for lightbox images to prevent the displaying issue of the transparent image on black background
8+
19
mkdocs-glightbox-0.2.1 (2022-08-10)
210

311
* Updated readme
@@ -8,21 +16,21 @@ mkdocs-glightbox-0.2.0 (2022-08-10)
816

917
mkdocs-glightbox-0.1.7 (2022-07-26)
1018

11-
* Fix #1: Ignore Emojis
19+
* Fixed #1: Ignore Emojis
1220

1321
mkdocs-glightbox-0.1.6 (2022-07-16)
1422

15-
* Fix some options not working bug
23+
* Fixed some options not working bug
1624

1725
mkdocs-glightbox-0.1.5 (2022-07-16)
1826

19-
* Fix mkdocs-material header + sidebar vanishing issue when open lightbox (Inspired from https://github.com/biati-digital/glightbox/issues/22)
20-
* Fix mkdocs-material content shrinking causing footer offset issue when open lightbox
21-
* Support compatible with mkdocs-material Instant loading feature
27+
* Fixed mkdocs-material header + sidebar vanishing issue when opening lightbox (Inspired from https://github.com/biati-digital/glightbox/issues/22)
28+
* Fixed mkdocs-material content shrinking causing footer offset issue when open lightbox
29+
* Supported compatible with mkdocs-material Instant loading feature
2230

2331
mkdocs-glightbox-0.1.4 (2022-06-12)
2432

25-
* Fix assets location bug
33+
* Fixed assets location bug
2634

2735
mkdocs-glightbox-0.1.3 (2022-06-10)
2836

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,29 @@ GLightbox is a pure javascript lightbox library with mobile support.
4343
height: auto
4444
zoomable: true
4545
draggable: true
46+
skip_classes:
47+
- custom-skip-class-name
48+
auto_caption: false
49+
caption_position: bottom
4650
```
4751

48-
| Option | Default | Description |
49-
|-----------------|---------|--------------------------------------------------------------------------------------------------------------|
50-
| touchNavigation | true | Enable or disable the touch navigation (swipe). |
51-
| loop | false | Loop slides on end. |
52-
| effect | zoom | Name of the effect on lightbox open. (zoom, fade, none) |
53-
| width | 100% | Default width for inline elements and iframes. You can use any unit for example 90% or 100vw for full width. |
54-
| height | auto | Default height for inline elements and iframes. You can use any unit for example 90%, 100vh or auto. |
55-
| zoomable | true | Enable or disable zoomable images. |
56-
| draggable | true | Enable or disable mouse drag to go prev and next slide. |
52+
| Option | Default | Description |
53+
|------------------|---------|------------------------------------------------------------------------------------------------------|
54+
| touchNavigation | true | Enable or disable the touch navigation (swipe). |
55+
| loop | false | Loop slides on end. |
56+
| effect | zoom | Name of the effect on lightbox open. (zoom, fade, none) |
57+
| width | 100% | Width for inline elements and iframes. You can use any unit for example 90% or 100vw for full width. |
58+
| height | auto | Height for inline elements and iframes. You can use any unit for example 90%, 100vh or auto. |
59+
| zoomable | true | Enable or disable zoomable images. |
60+
| draggable | true | Enable or disable mouse drag to go prev and next slide. |
61+
| skip_classes | [ ] | Disable lightbox of those image with specific custom class name. |
62+
| auto_caption | false | Enable or disable using alt of image as caption title automatically. |
63+
| caption_position | bottom | Default captions position. (bottom, top, left, right) |
5764

5865
Check more options information on [GLightbox Docs](https://github.com/biati-digital/glightbox#lightbox-options).
5966

6067
4. For more flexibility, you can disable lightbox by a [specific image](https://blueswen.github.io/mkdocs-glightbox/disable/image) or a [specific page](https://blueswen.github.io/mkdocs-glightbox/disable/page).
68+
5. Support lightbox image caption, check more details on [Caption](https://blueswen.github.io/mkdocs-glightbox/caption)
6169

6270
## License
6371

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
glightbox.auto_caption: true
3+
---
4+
5+
# Caption
6+
7+
Built-in GLightbox caption with title and description can be used by adding attributes: ```data-title```, ```data-description``` through markdown_extensions ```attr_list```. Enable ```attr_list``` via ```mkdocs.yml```:
8+
9+
```yaml
10+
markdown_extensions:
11+
- attr_list
12+
```
13+
14+
Check more detail about ```attr_list``` on the [official document](https://python-markdown.github.io/extensions/attr_list/).
15+
16+
!!! warning "Warning"
17+
18+
When the title or the description has been set, the plugin setting of lightbox image ```height``` and ```width``` will be overridden as ```100vh```.
19+
20+
## Usage
21+
22+
### Title and description attributes
23+
24+
```markdown title="Setting title and description with attributes"
25+
![Madeira, Portugal](../images/gallery/blueswen-madeira.jpeg){ data-title="Madeira, Portugal." data-description="Madeira, an autonomous region of Portugal, is an archipelago comprising 4 islands off the northwest coast of Africa. - Google" }
26+
```
27+
28+
<div class="result" markdown>
29+
<figure markdown>
30+
31+
![Madeira, Portugal](../images/gallery/blueswen-madeira.jpeg){ width="500px" data-title="Madeira, Portugal." data-description="Madeira, an autonomous region of Portugal, is an archipelago comprising 4 islands off the northwest coast of Africa. - Google" }
32+
33+
<figcaption>Madeira, Portugal. Credit: Blueswen</figcaption>
34+
</figure>
35+
</div>
36+
37+
### Caption position
38+
39+
Caption position can be changed with plugin option ```caption_position``` globally or individually by attribute ```data-caption-position```.
40+
41+
```markdown title="Setting position with data-caption-position"
42+
![Cabo da Roca, Portugal](../images/gallery/blueswen-cabo-da-roca.jpeg){ data-title="Cabo da Roca, Portugal. Credit: Blueswen" data-description=".custom-desc1" data-caption-position="right"}
43+
```
44+
45+
<div class="result" markdown>
46+
<figure markdown>
47+
![Cabo da Roca, Portugal](../images/gallery/blueswen-cabo-da-roca.jpeg){ width="400px" data-title="Cabo da Roca, Portugal. Credit: Blueswen" data-description="Monument announcing Cabo da Roca as the westernmost point of continental Europe" data-caption-position="right"}
48+
<figcaption>Cabo da Roca, Portugal. Credit: Blueswen</figcaption>
49+
</figure>
50+
</div>
51+
52+
### Advanced description
53+
54+
For a longer description, you can add a ```div``` with class ```glightbox-desc``` and a custom class name which be assigned in ```data-description``` with a prefix ```.```. The content in div will be used as the description.
55+
56+
```html title="Advanced Description"
57+
![Castelo de São Jorge, Lisbon, Portugal](../images/gallery/blueswen-lisbon.jpeg){ width="500px" data-title="Cabo da Roca, Portugal. Credit: Blueswen" data-description=".custom-desc1" }
58+
59+
<div class="glightbox-desc custom-desc1">
60+
<p>Saint George's Castle is a historic castle in the Portuguese capital of Lisbon, located in the freguesia of Santa Maria Maior.</p>
61+
<p>Human occupation of the castle hill dates to at least the 8th century BC while the first fortifications built date from the 1st century BC.</p>
62+
</div>
63+
```
64+
65+
<div class="result" markdown>
66+
<figure markdown>
67+
![Castelo de São Jorge, Lisbon, Portugal](../images/gallery/blueswen-lisbon.jpeg){ width="500px" data-title="Cabo da Roca, Portugal. Credit: Blueswen" data-description=".custom-desc1" }
68+
<figcaption>Castelo de São Jorge, Lisbon, Portugal. Credit: Blueswen</figcaption>
69+
</figure>
70+
71+
<div class="glightbox-desc custom-desc1">
72+
<p>Saint George's Castle is a historic castle in the Portuguese capital of Lisbon, located in the freguesia of Santa Maria Maior.</p>
73+
<p>Human occupation of the castle hill dates to at least the 8th century BC while the first fortifications built date from the 1st century BC.</p>
74+
</div>
75+
</div>
76+
77+
### Image alt as the caption
78+
79+
Since adding a title attribute to each image may be frustrating, we provide an ```auto_caption``` option to use the image alt as the default title.
80+
81+
- Globally: Enable the ```auto_caption``` plugin option in ```mkdocs.yml``` to affect whole mkdocs
82+
83+
```yaml
84+
plugins:
85+
- glightbox:
86+
auto_caption: true
87+
```
88+
89+
- Locally: Add page metadata ```glightbox.auto_caption: true``` through markdown_extensions ```meta``` setting page meta on a specific page. Enable ```meta``` via ```mkdocs.yml```:
90+
91+
```yaml
92+
markdown_extensions:
93+
- meta
94+
```
95+
96+
Check more detail about ```meta``` on the [official document](https://python-markdown.github.io/extensions/meta_data/).
97+
98+
```markdown title="Using image alt as caption title with page meta"
99+
---
100+
glightbox.auto_caption: true
101+
---
102+
103+
![Yosemite, USA.](../images/gallery/blueswen-yosemite.jpeg)
104+
```
105+
106+
<div class="result" markdown>
107+
<figure markdown>
108+
109+
![Yosemite, USA.](../images/gallery/blueswen-yosemite.jpeg){ width="500px"}
110+
111+
<figcaption>Yosemite, USA. Credit: Blueswen</figcaption>
112+
</figure>
113+
</div>

demo-mkdocs/docs/disable/image.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
You can disable lightbox of images separately by adding ```off-glb``` class through markdown_extensions ```attr_list```. Enable ```attr_list``` via ```mkdocs.yml```:
1+
You can disable lightbox of images separately by adding ```off-glb``` or customized class through markdown_extensions ```attr_list```. Enable ```attr_list``` via ```mkdocs.yml```:
22

33
```yaml
44
markdown_extensions:
@@ -7,20 +7,44 @@ markdown_extensions:
77
88
Check more detail about ```attr_list``` on the [official document](https://python-markdown.github.io/extensions/attr_list/).
99

10+
The customized classes could be set in plugin option:
11+
12+
```yaml
13+
plugins:
14+
- glightbox:
15+
skip_classes:
16+
- skip-lightbox
17+
```
18+
1019
## Demo
1120

12-
The first image's lightbox is disabled.
21+
The lightbox of the image with class ```off-glb``` or ```skip-lightbox``` (a custom class in plugin ```skip_classes``` options) is disabled.
1322

1423
```markdown
1524
![Lanyu, Taiwan](../images/gallery/blueswen-lanyu.jpeg){ .off-glb }
16-
Lanyu, Taiwan. Credit: Blueswen
1725
18-
![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)
19-
Obertraun, Austria. Credit: Blueswen
26+
![Hallstatt, Austria](../images/gallery/blueswen-hallstatt.jpeg){ .skip-lightbox }
27+
28+
![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)
2029
```
2130

31+
<figure markdown>
32+
2233
![Lanyu, Taiwan](../images/gallery/blueswen-lanyu.jpeg){ .off-glb }
23-
Lanyu, Taiwan. Credit: Blueswen
2434

25-
![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)
26-
Obertraun, Austria. Credit: Blueswen
35+
<figcaption>Lanyu, Taiwan. Credit: Blueswen</figcaption>
36+
</figure>
37+
38+
<figure markdown>
39+
40+
![Hallstatt, Austria](../images/gallery/blueswen-hallstatt.jpeg){ .skip-lightbox }
41+
42+
<figcaption>Hallstatt, Austria. Credit: Blueswen</figcaption>
43+
</figure>
44+
45+
<figure markdown>
46+
47+
![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)
48+
49+
<figcaption>Obertraun, Austria. Credit: Blueswen</figcaption>
50+
</figure>

demo-mkdocs/docs/disable/page.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,29 @@ glightbox: false
2323
![Lanyu, Taiwan](../images/gallery/blueswen-lanyu.jpeg)
2424
Lanyu, Taiwan. Credit: Blueswen
2525
26+
![Hallstatt, Austria](../images/gallery/blueswen-hallstatt.jpeg)
27+
Hallstatt, Austria. Credit: Blueswen
28+
2629
![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)
2730
Obertraun, Austria. Credit: Blueswen
2831
```
32+
<figure markdown>
2933

3034
![Lanyu, Taiwan](../images/gallery/blueswen-lanyu.jpeg)
31-
Lanyu, Taiwan. Credit: Blueswen
35+
36+
<figcaption>Lanyu, Taiwan. Credit: Blueswen</figcaption>
37+
</figure>
38+
39+
<figure markdown>
40+
41+
![Hallstatt, Austria](../images/gallery/blueswen-hallstatt.jpeg)
42+
43+
<figcaption>Hallstatt, Austria. Credit: Blueswen</figcaption>
44+
</figure>
45+
46+
<figure markdown>
3247

3348
![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)
34-
Obertraun, Austria. Credit: Blueswen
49+
50+
<figcaption>Obertraun, Austria. Credit: Blueswen</figcaption>
51+
</figure>
493 KB
Loading
462 KB
Loading
747 KB
Loading

demo-mkdocs/docs/index.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,55 @@ GLightbox is a pure javascript lightbox library with mobile support.
3838
height: auto
3939
zoomable: true
4040
draggable: true
41+
skip_classes:
42+
- custom-skip-class-name
43+
auto_caption: false
44+
caption_position: bottom
4145
```
4246

43-
| Option | Default | Description |
44-
|-----------------|---------|--------------------------------------------------------------------------------------------------------------|
45-
| touchNavigation | true | Enable or disable the touch navigation (swipe). |
46-
| loop | false | Loop slides on end. |
47-
| effect | zoom | Name of the effect on lightbox open. (zoom, fade, none) |
48-
| width | 100% | Default width for inline elements and iframes. You can use any unit for example 90% or 100vw for full width. |
49-
| height | auto | Default height for inline elements and iframes. You can use any unit for example 90%, 100vh or auto. |
50-
| zoomable | true | Enable or disable zoomable images. |
51-
| draggable | true | Enable or disable mouse drag to go prev and next slide. |
47+
| Option | Default | Description |
48+
|------------------|---------|------------------------------------------------------------------------------------------------------|
49+
| touchNavigation | true | Enable or disable the touch navigation (swipe). |
50+
| loop | false | Loop slides on end. |
51+
| effect | zoom | Name of the effect on lightbox open. (zoom, fade, none) |
52+
| width | 100% | Width for inline elements and iframes. You can use any unit for example 90% or 100vw for full width. |
53+
| height | auto | Height for inline elements and iframes. You can use any unit for example 90%, 100vh or auto. |
54+
| zoomable | true | Enable or disable zoomable images. |
55+
| draggable | true | Enable or disable mouse drag to go prev and next slide. |
56+
| skip_classes | [ ] | Disable lightbox of those image with specific custom class name. |
57+
| auto_caption | false | Enable or disable using alt of image as caption title automatically. |
58+
| caption_position | bottom | Default captions position. (bottom, top, left, right) |
5259

5360
Check more options information on [GLightbox Docs](https://github.com/biati-digital/glightbox#lightbox-options).
5461

5562
4. For more flexibility, you can disable lightbox by a [specific image](./disable/image.md) or a [specific page](./disable/page.md).
63+
5. Support lightbox image caption, check more details on [Caption](./caption/caption.md)
5664

5765
## Demo
5866

5967
Click the image to try lightbox and enjoy the view of Taiwan.
6068

69+
<figure markdown>
70+
6171
![Sunset over Taipei City](./images/thomas-tucker-sunset-over-taipei-city.jpg)
62-
Sunset over Taipei City. Credit: [Thomas Tucker](https://unsplash.com/photos/au3CYbd7vCU)
72+
73+
<figcaption markdown>Sunset over Taipei City. Credit: [Thomas Tucker](https://unsplash.com/photos/au3CYbd7vCU)</figcaption>
74+
</figure>
75+
76+
<figure markdown>
6377

6478
![Lanyu, Taiwan](./images/robson-hatsukami-morgan-lanyu.jpg)
65-
Lanyu, Taiwan. Credit: [Robson Hatsukami Morgan](https://unsplash.com/photos/T8LZZvKc9Jc)
79+
80+
<figcaption markdown>Lanyu, Taiwan. Credit: [Robson Hatsukami Morgan](https://unsplash.com/photos/T8LZZvKc9Jc)</figcaption>
81+
</figure>
82+
83+
<figure markdown>
6684

6785
![Kenting, Taiwan](./images/yuhan-chang-kenting.jpg)
68-
Kenting, Taiwan. Credit: [Yuhan Chang](https://unsplash.com/photos/ROWXoqmqyjk)
86+
87+
<figcaption markdown>Kenting, Taiwan. Credit: [Yuhan Chang](https://unsplash.com/photos/ROWXoqmqyjk)</figcaption>
88+
</figure>
89+
6990

7091
## License
7192

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1+
<figure markdown>
2+
13
![Jioufen, Taiwan](../images/andy-wang-jioufen.jpg)
2-
Jioufen, Taiwan. Credit: [Andy Wang](https://unsplash.com/photos/eOcOTrceCmQ)
4+
5+
<figcaption markdown>Jioufen, Taiwan. Credit: [Andy Wang](https://unsplash.com/photos/eOcOTrceCmQ)</figcaption>
6+
</figure>
7+
8+
<figure markdown>
39

410
![Hehuanshan, Taiwan](../images/chunchia-hehuanshan.jpg)
5-
Hehuanshan, Taiwan. Credit: [張 峻嘉](https://unsplash.com/photos/ZFddx3rGaow)
11+
12+
<figcaption markdown>Hehuanshan, Taiwan. Credit: [張 峻嘉](https://unsplash.com/photos/ZFddx3rGaow)</figcaption>
13+
</figure>
14+
15+
<figure markdown>
616

717
![Alishan, Taiwan](../images/alexa-soh-alishan.jpg)
8-
Alishan, Taiwan. Credit: [Alexa Soh](https://unsplash.com/photos/nDVqwAH6DDA)
18+
19+
<figcaption markdown>Alishan, Taiwan. Credit: [Alexa Soh](https://unsplash.com/photos/nDVqwAH6DDA)</figcaption>
20+
</figure>

0 commit comments

Comments
 (0)