Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
blueswen committed Oct 1, 2022
1 parent 0a6ab76 commit 74cbf2a
Show file tree
Hide file tree
Showing 34 changed files with 1,045 additions and 244 deletions.
20 changes: 14 additions & 6 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
mkdocs-glightbox-0.3.0 (2022-09-29)

* Fixed width and height setting in config not working bug
* Supported specific skip class (#5)
* Supported glightbox built-in caption with title and description (#4)
* Fixed page jitter when lightbox closing issue using Material for MkDocs
* Add white background for lightbox images to prevent the displaying issue of the transparent image on black background

mkdocs-glightbox-0.2.1 (2022-08-10)

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

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

* Fix #1: Ignore Emojis
* Fixed #1: Ignore Emojis

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

* Fix some options not working bug
* Fixed some options not working bug

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

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

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

* Fix assets location bug
* Fixed assets location bug

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

Expand Down
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,29 @@ GLightbox is a pure javascript lightbox library with mobile support.
height: auto
zoomable: true
draggable: true
skip_classes:
- custom-skip-class-name
auto_caption: false
caption_position: bottom
```

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

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

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).
5. Support lightbox image caption, check more details on [Caption](https://blueswen.github.io/mkdocs-glightbox/caption)

## License

Expand Down
113 changes: 113 additions & 0 deletions demo-mkdocs/docs/caption/caption.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
glightbox.auto_caption: true
---

# Caption

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```:

```yaml
markdown_extensions:
- attr_list
```
Check more detail about ```attr_list``` on the [official document](https://python-markdown.github.io/extensions/attr_list/).

!!! warning "Warning"

When the title or the description has been set, the plugin setting of lightbox image ```height``` and ```width``` will be overridden as ```100vh```.

## Usage

### Title and description attributes

```markdown title="Setting title and description with attributes"
![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" }
```

<div class="result" markdown>
<figure markdown>

![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" }

<figcaption>Madeira, Portugal. Credit: Blueswen</figcaption>
</figure>
</div>

### Caption position

Caption position can be changed with plugin option ```caption_position``` globally or individually by attribute ```data-caption-position```.

```markdown title="Setting position with data-caption-position"
![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"}
```

<div class="result" markdown>
<figure markdown>
![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"}
<figcaption>Cabo da Roca, Portugal. Credit: Blueswen</figcaption>
</figure>
</div>

### Advanced description

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.

```html title="Advanced Description"
![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" }
<div class="glightbox-desc custom-desc1">
<p>Saint George's Castle is a historic castle in the Portuguese capital of Lisbon, located in the freguesia of Santa Maria Maior.</p>
<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>
</div>
```

<div class="result" markdown>
<figure markdown>
![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" }
<figcaption>Castelo de São Jorge, Lisbon, Portugal. Credit: Blueswen</figcaption>
</figure>

<div class="glightbox-desc custom-desc1">
<p>Saint George's Castle is a historic castle in the Portuguese capital of Lisbon, located in the freguesia of Santa Maria Maior.</p>
<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>
</div>
</div>

### Image alt as the caption

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.

- Globally: Enable the ```auto_caption``` plugin option in ```mkdocs.yml``` to affect whole mkdocs

```yaml
plugins:
- glightbox:
auto_caption: true
```

- Locally: Add page metadata ```glightbox.auto_caption: true``` through markdown_extensions ```meta``` setting page meta on a specific page. Enable ```meta``` via ```mkdocs.yml```:

```yaml
markdown_extensions:
- meta
```

Check more detail about ```meta``` on the [official document](https://python-markdown.github.io/extensions/meta_data/).

```markdown title="Using image alt as caption title with page meta"
---
glightbox.auto_caption: true
---
![Yosemite, USA.](../images/gallery/blueswen-yosemite.jpeg)
```

<div class="result" markdown>
<figure markdown>

![Yosemite, USA.](../images/gallery/blueswen-yosemite.jpeg){ width="500px"}

<figcaption>Yosemite, USA. Credit: Blueswen</figcaption>
</figure>
</div>
40 changes: 32 additions & 8 deletions demo-mkdocs/docs/disable/image.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
You can disable lightbox of images separately by adding ```off-glb``` class through markdown_extensions ```attr_list```. Enable ```attr_list``` via ```mkdocs.yml```:
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```:

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

The customized classes could be set in plugin option:

```yaml
plugins:
- glightbox:
skip_classes:
- skip-lightbox
```

## Demo

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

```markdown
![Lanyu, Taiwan](../images/gallery/blueswen-lanyu.jpeg){ .off-glb }
Lanyu, Taiwan. Credit: Blueswen
![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)
Obertraun, Austria. Credit: Blueswen
![Hallstatt, Austria](../images/gallery/blueswen-hallstatt.jpeg){ .skip-lightbox }
![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)
```

<figure markdown>

![Lanyu, Taiwan](../images/gallery/blueswen-lanyu.jpeg){ .off-glb }
Lanyu, Taiwan. Credit: Blueswen

![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)
Obertraun, Austria. Credit: Blueswen
<figcaption>Lanyu, Taiwan. Credit: Blueswen</figcaption>
</figure>

<figure markdown>

![Hallstatt, Austria](../images/gallery/blueswen-hallstatt.jpeg){ .skip-lightbox }

<figcaption>Hallstatt, Austria. Credit: Blueswen</figcaption>
</figure>

<figure markdown>

![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)

<figcaption>Obertraun, Austria. Credit: Blueswen</figcaption>
</figure>
21 changes: 19 additions & 2 deletions demo-mkdocs/docs/disable/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,29 @@ glightbox: false
![Lanyu, Taiwan](../images/gallery/blueswen-lanyu.jpeg)
Lanyu, Taiwan. Credit: Blueswen
![Hallstatt, Austria](../images/gallery/blueswen-hallstatt.jpeg)
Hallstatt, Austria. Credit: Blueswen
![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)
Obertraun, Austria. Credit: Blueswen
```
<figure markdown>

![Lanyu, Taiwan](../images/gallery/blueswen-lanyu.jpeg)
Lanyu, Taiwan. Credit: Blueswen

<figcaption>Lanyu, Taiwan. Credit: Blueswen</figcaption>
</figure>

<figure markdown>

![Hallstatt, Austria](../images/gallery/blueswen-hallstatt.jpeg)

<figcaption>Hallstatt, Austria. Credit: Blueswen</figcaption>
</figure>

<figure markdown>

![Obertraun, Austria](../images/gallery/blueswen-obertraun.jpeg)
Obertraun, Austria. Credit: Blueswen

<figcaption>Obertraun, Austria. Credit: Blueswen</figcaption>
</figure>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 33 additions & 12 deletions demo-mkdocs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,55 @@ GLightbox is a pure javascript lightbox library with mobile support.
height: auto
zoomable: true
draggable: true
skip_classes:
- custom-skip-class-name
auto_caption: false
caption_position: bottom
```

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

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

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

## Demo

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

<figure markdown>

![Sunset over Taipei City](./images/thomas-tucker-sunset-over-taipei-city.jpg)
Sunset over Taipei City. Credit: [Thomas Tucker](https://unsplash.com/photos/au3CYbd7vCU)

<figcaption markdown>Sunset over Taipei City. Credit: [Thomas Tucker](https://unsplash.com/photos/au3CYbd7vCU)</figcaption>
</figure>

<figure markdown>

![Lanyu, Taiwan](./images/robson-hatsukami-morgan-lanyu.jpg)
Lanyu, Taiwan. Credit: [Robson Hatsukami Morgan](https://unsplash.com/photos/T8LZZvKc9Jc)

<figcaption markdown>Lanyu, Taiwan. Credit: [Robson Hatsukami Morgan](https://unsplash.com/photos/T8LZZvKc9Jc)</figcaption>
</figure>

<figure markdown>

![Kenting, Taiwan](./images/yuhan-chang-kenting.jpg)
Kenting, Taiwan. Credit: [Yuhan Chang](https://unsplash.com/photos/ROWXoqmqyjk)

<figcaption markdown>Kenting, Taiwan. Credit: [Yuhan Chang](https://unsplash.com/photos/ROWXoqmqyjk)</figcaption>
</figure>


## License

Expand Down
18 changes: 15 additions & 3 deletions demo-mkdocs/docs/taiwan/mountain.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
<figure markdown>

![Jioufen, Taiwan](../images/andy-wang-jioufen.jpg)
Jioufen, Taiwan. Credit: [Andy Wang](https://unsplash.com/photos/eOcOTrceCmQ)

<figcaption markdown>Jioufen, Taiwan. Credit: [Andy Wang](https://unsplash.com/photos/eOcOTrceCmQ)</figcaption>
</figure>

<figure markdown>

![Hehuanshan, Taiwan](../images/chunchia-hehuanshan.jpg)
Hehuanshan, Taiwan. Credit: [張 峻嘉](https://unsplash.com/photos/ZFddx3rGaow)

<figcaption markdown>Hehuanshan, Taiwan. Credit: [張 峻嘉](https://unsplash.com/photos/ZFddx3rGaow)</figcaption>
</figure>

<figure markdown>

![Alishan, Taiwan](../images/alexa-soh-alishan.jpg)
Alishan, Taiwan. Credit: [Alexa Soh](https://unsplash.com/photos/nDVqwAH6DDA)

<figcaption markdown>Alishan, Taiwan. Credit: [Alexa Soh](https://unsplash.com/photos/nDVqwAH6DDA)</figcaption>
</figure>
19 changes: 16 additions & 3 deletions demo-mkdocs/docs/taiwan/sea.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@

<figure markdown>

![Penghu, Taiwan](../images/maggie-hung-penghu.jpg)
Penghu, Taiwan. Credit: [Maggie Hung](https://unsplash.com/photos/hcMd-8aLEdI)

<figcaption markdown>Penghu, Taiwan. Credit: [Maggie Hung](https://unsplash.com/photos/hcMd-8aLEdI)</figcaption>
</figure>

<figure markdown>

![Ch'ing-shui Cliff in Hualian](../images/bells-mayer-ching-shui-cliff.jpg)
Ch'ing-shui Cliff in Hualian, Taiwan. Credit: [Bells Mayer](https://unsplash.com/photos/ROWXoqmqyjk)

<figcaption markdown>Ch'ing-shui Cliff in Hualian, Taiwan. Credit: [Bells Mayer](https://unsplash.com/photos/ROWXoqmqyjk)</figcaption>
</figure>

<figure markdown>

![Chi-shing-tan, Taiwan](../images/sam-chang-chi-shing-tan.jpg)
Chi-shing-tan, Taiwan. Credit: [Sam Chang](https://unsplash.com/photos/qeETHbnFP3k)

<figcaption markdown>Chi-shing-tan, Taiwan. Credit: [Sam Chang](https://unsplash.com/photos/qeETHbnFP3k)</figcaption>
</figure>
Loading

0 comments on commit 74cbf2a

Please sign in to comment.