pax_global_header 0000666 0000000 0000000 00000000064 15076440547 0014526 g ustar 00root root 0000000 0000000 52 comment=c94b0616480e96a86939a2a248f18a6f57f80516 mkdocs-glightbox-0.5.2/ 0000775 0000000 0000000 00000000000 15076440547 0014777 5 ustar 00root root 0000000 0000000 mkdocs-glightbox-0.5.2/.flake8 0000664 0000000 0000000 00000000046 15076440547 0016152 0 ustar 00root root 0000000 0000000 [flake8] ignore = E501,E722,D104,W503 mkdocs-glightbox-0.5.2/.github/ 0000775 0000000 0000000 00000000000 15076440547 0016337 5 ustar 00root root 0000000 0000000 mkdocs-glightbox-0.5.2/.github/FUNDING.yml 0000664 0000000 0000000 00000000020 15076440547 0020144 0 ustar 00root root 0000000 0000000 ko_fi: blueswen mkdocs-glightbox-0.5.2/.github/workflows/ 0000775 0000000 0000000 00000000000 15076440547 0020374 5 ustar 00root root 0000000 0000000 mkdocs-glightbox-0.5.2/.github/workflows/ci.yaml 0000664 0000000 0000000 00000002131 15076440547 0021650 0 ustar 00root root 0000000 0000000 name: CI on: [push, pull_request] jobs: run: name: Lint, Type Check, Security Scan & Build Test runs-on: ubuntu-latest steps: - uses: actions/checkout@master - name: Install uv uses: astral-sh/setup-uv@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: ".python-version" - name: Install the project run: uv sync --all-extras --dev --frozen - name: Run Ruff (Code Formatting Check) run: uv run ruff check . - name: Run Bandit (Scan Python code for security issues) run: uv run bandit -r mkdocs_glightbox - name: Run tests run: uv run pytest tests -m "not e2e" - name: Build the package run: uv build - name: Check package with Twine run: uv run twine check dist/* - name: Install package from local build run: | uv venv test-install source test-install/bin/activate uv pip install dist/*.whl mkdocs uv run --active mkdocs build -f tests/fixtures/mkdocs.yml mkdocs-glightbox-0.5.2/.github/workflows/codeql-analysis.yml 0000664 0000000 0000000 00000001337 15076440547 0024213 0 ustar 00root root 0000000 0000000 name: 'CodeQL' on: push: branches: ['main'] pull_request: branches: ['main'] schedule: - cron: '39 19 * * 1' jobs: analyze: name: Analyze runs-on: ubuntu-latest permissions: actions: read contents: read security-events: write strategy: fail-fast: false matrix: language: ['python'] steps: - name: Checkout repository uses: actions/checkout@master - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} - name: Autobuild uses: github/codeql-action/autobuild@v2 - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 mkdocs-glightbox-0.5.2/.github/workflows/deploy-release.yml 0000664 0000000 0000000 00000001257 15076440547 0024036 0 ustar 00root root 0000000 0000000 name: Deploy release on: push: tags: - 'v*' jobs: pypi: permissions: id-token: write runs-on: ubuntu-latest environment: name: pypi url: https://pypi.org/p/mkdocs-glightbox steps: - uses: actions/checkout@master - name: Install uv uses: astral-sh/setup-uv@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: ".python-version" - name: Install the project run: uv sync --all-extras --dev --frozen - name: Build the package run: uv build - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 mkdocs-glightbox-0.5.2/.github/workflows/documentation.yml 0000664 0000000 0000000 00000002150 15076440547 0023766 0 ustar 00root root 0000000 0000000 name: Documentation on: workflow_dispatch: push: tags: - 'v*' # Run workflow on version tags, e.g. v1.0.0. permissions: contents: write jobs: deploy: runs-on: ubuntu-latest if: github.event.repository.fork == false steps: - uses: actions/checkout@master with: fetch-depth: 0 - name: Install uv uses: astral-sh/setup-uv@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: ".python-version" - name: Install the project run: uv sync --all-extras --dev --frozen - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - uses: actions/cache@v4 with: key: mkdocs-material-${{ env.cache_id }} path: .cache restore-keys: | mkdocs-material- - run: uv pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git - run: uv run mkdocs gh-deploy --force -f demo-mkdocs/mkdocs.yml env: GH_TOKEN: ${{ secrets.GH_TOKEN }} GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }} mkdocs-glightbox-0.5.2/.github/workflows/performance_test.yml 0000664 0000000 0000000 00000001515 15076440547 0024461 0 ustar 00root root 0000000 0000000 name: Performance Test on: [push, pull_request, workflow_dispatch] jobs: run: name: Run performance test runs-on: ubuntu-latest steps: - uses: actions/checkout@master - name: Install uv uses: astral-sh/setup-uv@v5 with: python-version: "3.12" - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install the project run: uv sync --all-extras --dev --frozen - name: Run performance test run: | echo '# Performance Test Results' >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY uv run pytest tests -m perf --log-level=INFO > result.log cat result.log cat result.log >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY mkdocs-glightbox-0.5.2/.github/workflows/scheduled_unittests.yml 0000664 0000000 0000000 00000001354 15076440547 0025204 0 ustar 00root root 0000000 0000000 name: Scheduled Unit Tests # Controls when the action will run. # Every week "At 07:17 on Sunday." # See https://crontab.guru/#17_7_*_*_7 # This way we know for sure package will keep working with # potential new downstream updates on: workflow_dispatch: schedule: - cron: "17 7 * * 0" jobs: run: name: Run unit tests runs-on: ubuntu-latest steps: - uses: actions/checkout@master - name: Install uv uses: astral-sh/setup-uv@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: ".python-version" - name: Install the project run: uv sync --all-extras --dev - name: Run tests run: uv run pytest tests -m "not e2e" mkdocs-glightbox-0.5.2/.github/workflows/unittests.yml 0000664 0000000 0000000 00000001434 15076440547 0023163 0 ustar 00root root 0000000 0000000 name: Unit Tests on: [push, pull_request, workflow_dispatch] jobs: run: name: Run unit tests with multiple Python versions runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@master - name: Install uv uses: astral-sh/setup-uv@v5 with: python-version: ${{ matrix.python-version }} - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install the project run: uv sync --all-extras --dev --frozen - name: Run tests run: uv run pytest tests -m "not perf" mkdocs-glightbox-0.5.2/.github/workflows/unittests_codecov.yml 0000664 0000000 0000000 00000002460 15076440547 0024665 0 ustar 00root root 0000000 0000000 name: Unit Tests with Codecov on: push: branches: - main pull_request: branches: - main workflow_dispatch: jobs: run: name: Run unit tests with codecov upload runs-on: ${{ matrix.os }} env: USING_COVERAGE: '3.12' strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: ["3.12"] steps: - uses: actions/checkout@master - name: Install uv uses: astral-sh/setup-uv@v5 with: python-version: ${{ matrix.python-version }} - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install the project run: uv sync --all-extras --dev --frozen - name: Run tests run: | git config --global user.name "Github Action" git config --global user.email "githubaction@gmail.com" uv run pytest --cov=mkdocs_glightbox --cov-report=xml -m "not pref" - name: Upload coverage to Codecov if: "contains(env.USING_COVERAGE, matrix.python-version)" uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.xml flags: unittests fail_ci_if_error: false mkdocs-glightbox-0.5.2/.gitignore 0000664 0000000 0000000 00000006055 15076440547 0016775 0 ustar 00root root 0000000 0000000 .DS_Store .vscode/ docs/ # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ cover/ .benchmarks/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ mkdocs-glightbox-0.5.2/.python-version 0000664 0000000 0000000 00000000005 15076440547 0017777 0 ustar 00root root 0000000 0000000 3.12 mkdocs-glightbox-0.5.2/CHANGELOG 0000664 0000000 0000000 00000005712 15076440547 0016216 0 ustar 00root root 0000000 0000000 mkdocs-glightbox-0.5.2 (2025-10-23) * Updated selectolax dependency to >=0.3.29 to support Python 3.14 (#64) mkdocs-glightbox-0.5.1 (2025-09-04) * Pined selectolax to 0.3.29 to avoid missing binary wheel issue on some platforms (#63) mkdocs-glightbox-0.5.0 (2025-09-03) * Updated glightbox to 3.3.1 * Migrated to uv and pyproject.toml for development and building * Replaced regex with Selectolax to improve performance, availability and maintainability (#44, #56, #61) * Updated tests and workflow * Support auto themed (#49) mkdocs-glightbox-0.4.0 (2023-05-06) * Supported manual mode (#29) * Allow calling lightbox methods from other places (#34) * Added id to appended script tag (#38) * Access theme attribute directly (#40) * Better JavaScript Error Handling (#36) mkdocs-glightbox-0.3.7 (2023-01-24) * Supported custom background and shadow (#27) mkdocs-glightbox-0.3.6 (2023-12-30) * Modified width default to auto prevent zooming large image bug (#21) * Supported only enable glightbox with on-glb class in given page (#28) mkdocs-glightbox-0.3.5 (2023-11-18) * Supported compatibility with the privacy plugin of Material for MkDocs insiders (#25) mkdocs-glightbox-0.3.4 (2023-04-25) * Fixed regex bug: quote issue and empty alt issue (#14 #19) mkdocs-glightbox-0.3.3 (2023-04-20) * Refactored processing logic with regex (#14) mkdocs-glightbox-0.3.2 (2023-03-19) * Supported image without extension (#13) mkdocs-glightbox-0.3.1 (2022-11-22) * Supported lightbox slide effect customization (#8) * Supported synchronized lightbox caption dark mode with Material for MkDocs (#7) * Supported glightbox built-in gallery feature (#11) * Supported skip image in the anchor tag 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 mkdocs-glightbox-0.2.0 (2022-08-10) * Added support for disabling glightbox with image class or page meta (#2) mkdocs-glightbox-0.1.7 (2022-07-26) * Fixed #1: Ignore Emojis mkdocs-glightbox-0.1.6 (2022-07-16) * Fixed some options not working bug mkdocs-glightbox-0.1.5 (2022-07-16) * 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) * Fixed assets location bug mkdocs-glightbox-0.1.3 (2022-06-10) * First release mkdocs-glightbox-0.5.2/LICENSE 0000664 0000000 0000000 00000002051 15076440547 0016002 0 ustar 00root root 0000000 0000000 MIT License Copyright (c) 2022 Blueswen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. mkdocs-glightbox-0.5.2/README.md 0000664 0000000 0000000 00000013357 15076440547 0016267 0 ustar 00root root 0000000 0000000 # MkDocs GLightbox
A MkDocs plugin supports image lightbox with [GLightbox](https://github.com/biati-digital/glightbox). GLightbox is a pure javascript lightbox library with mobile support. [Live demo](https://blueswen.github.io/mkdocs-glightbox/) with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/). ## Dependency 1. GLightbox javascript file and CSS file 1. GLightbox==3.3.1 2. selectolax process HTML 1. selectolax>=0.3.29 ## Usage 1. Install the plugin from PyPI ```bash pip install mkdocs-glightbox ``` 2. Add ```glightbox``` plugin to your mkdocs.yml plugins sections: ```yaml plugins: - glightbox ``` 3. All images will be added to the lightbox effect automatically, except images in an anchor tag and emoji images from [pymdown-extensions](https://facelessuser.github.io/pymdown-extensions/extensions/emoji/). 4. You may customize the plugin by passing options in mkdocs.yml: ```yaml plugins: - glightbox: touchNavigation: true loop: false effect: zoom slide_effect: slide width: 100% height: auto zoomable: true draggable: true skip_classes: - custom-skip-class-name auto_themed: false auto_caption: false caption_position: bottom background: white shadow: true manual: false ``` | 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) | | slide_effect | slide | Name of the effect on lightbox slide. (slide, zoom, fade, none) | | width | auto | 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_themed | false | Enable or disable supporting light and dark mode of mkdocs material. | | auto_caption | false | Enable or disable using alt of image as caption title automatically. | | caption_position | bottom | Default captions position. (bottom, top, left, right) | | background | white | The background CSS of lightbox image. The background will shown when the image is transparent. You can use any CSS value for the background for example `#74b9ff` or `Gainsboro` or `none` for nothing. | | shadow | true | Enable or disable the shadow of lightbox image. Disable it when the background is `none` to prevent shadow around the transparent image. | | manual | false | When true, lightbox has to be enabled for each image manually by adding `on-glb` class to it or adding `glightbox: true` meta on page. | Check more options information on [GLightbox Docs](https://github.com/biati-digital/glightbox#lightbox-options). 5. For more flexibility: 1. [Disable by image](https://blueswen.github.io/mkdocs-glightbox/flexibility/disable-by-image/): Disable the lightbox for specific images. Suitable for a few amount of images that don't need the lightbox effect. 2. [Disable by page](https://blueswen.github.io/mkdocs-glightbox/flexibility/disable-by-page/): Disable the lightbox for specific pages. Suitable for a few amount of pages that don't need the lightbox effect. 3. [Enable by image](https://blueswen.github.io/mkdocs-glightbox/flexibility/disable-by-page-enable-by-image/): Disable the lightbox for specific pages but enable some images on those pages. Suitable for a few amount of images that need the lightbox effect. 4. [Disable globally but enable by image or page](https://blueswen.github.io/mkdocs-glightbox/flexibility/enable-by-image-or-page/): Disable the lightbox globally but enable specific images or specific pages. Suitable for a large number of images or pages that don't need the lightbox effect. 6. Support lightbox image caption, check more details on [Caption](https://blueswen.github.io/mkdocs-glightbox/caption/caption/). 7. Support grouping images as galleries, check more details on [Gallery](https://blueswen.github.io/mkdocs-glightbox/gallery/gallery/). > [!NOTE] > If this is your first time using the MkDocs plugin feature, you should know that MkDocs includes a default plugin named `search`. If you want to keep the search feature, you need to add the `search` plugin back to the `plugins` list. ## How it works 1. Copy GLightbox script file into `site/assets/javascripts/` directory and CSS file into `site/assets/stylesheets/` directory 2. Import GLightbox script and CSS file and add javascript code on each page excluded disabled pages 3. Search all image tags and warp with an anchor tag for GLightbox excluded images with skip class or already warped with an anchor tag ## License This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/Blueswen/mkdocs-glightbox/blob/main/LICENSE) file for details. mkdocs-glightbox-0.5.2/demo-mkdocs/ 0000775 0000000 0000000 00000000000 15076440547 0017201 5 ustar 00root root 0000000 0000000 mkdocs-glightbox-0.5.2/demo-mkdocs/docs/ 0000775 0000000 0000000 00000000000 15076440547 0020131 5 ustar 00root root 0000000 0000000 mkdocs-glightbox-0.5.2/demo-mkdocs/docs/caption/ 0000775 0000000 0000000 00000000000 15076440547 0021566 5 ustar 00root root 0000000 0000000 mkdocs-glightbox-0.5.2/demo-mkdocs/docs/caption/caption.md 0000664 0000000 0000000 00000012227 15076440547 0023551 0 ustar 00root root 0000000 0000000 --- glightbox.auto_caption: true --- # Caption Built-in GLightbox caption feature with title and description in the **light box** 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 details 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" { 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" } ```Saint George's Castle is a historic castle in the Portuguese capital of Lisbon, located in the freguesia of Santa Maria Maior.
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.
Saint George's Castle is a historic castle in the Portuguese capital of Lisbon, located in the freguesia of Santa Maria Maior.
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.