Giter Site home page Giter Site logo

Comments (7)

blueswen avatar blueswen commented on August 23, 2024 1

@tgit-hub Apologies for any inconvenience caused. The latest version (v0.3.4) of the plugin has addressed this issue, and if any other wrapping errors occur, a warning log will be generated instead of causing the build to fail.

from mkdocs-glightbox.

usulpt avatar usulpt commented on August 23, 2024

this is a problem for me and while I love the simple and beautiful way the lightbox is displayed, the extra build time kills my pipeline and I have to stop using it :(

from mkdocs-glightbox.

blueswen avatar blueswen commented on August 23, 2024

Sorry for the late reply. In the newest version(v0.3.3) I refactored the processing logic with regex (thanks ChatGPT!). I tested with mkdocs on 50 markdown files and over 300 images for each markdown, and there was no noticeable difference in build time whether or not the mkdocs-glightbox plugin was used. I hope this meets your requirements.

Thank you all for loving this plugin. Let me know if I can improve it further.

from mkdocs-glightbox.

usulpt avatar usulpt commented on August 23, 2024

well, it worked :) excellent stuff, I'm back to using and enjoying it! thanks for the quick fix!

from mkdocs-glightbox.

tgit-hub avatar tgit-hub commented on August 23, 2024

Unfortunately, following an update to 0.3.3, my build failed with:

Traceback (most recent call last):
  File "./myapp/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "./myapp/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "./myapp/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "./myapp/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "./myapp/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "./myapp/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "./myapp/lib/python3.10/site-packages/mkdocs/__main__.py", line 234, in serve_command
    serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
  File "./myapp/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 83, in serve
    builder(config)
  File "./myapp/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 76, in builder
    build(config, live_server=live_server, dirty=dirty)
  File "./myapp/lib/python3.10/site-packages/mkdocs/commands/build.py", line 308, in build
    _populate_page(file.page, config, files, dirty)
  File "./myapp/lib/python3.10/site-packages/mkdocs/commands/build.py", line 184, in _populate_page
    page.content = config.plugins.run_event(
  File "./myapp/lib/python3.10/site-packages/mkdocs/plugins.py", line 520, in run_event
    result = method(item, **kwargs)
  File "./myapp/lib/python3.10/site-packages/mkdocs_glightbox/plugin.py", line 106, in on_page_content
    html = pattern.sub(
  File "./myapp/lib/python3.10/site-packages/mkdocs_glightbox/plugin.py", line 107, in <lambda>
    lambda match: self.wrap_img_with_anchor(
  File "./myapp/lib/python3.10/site-packages/mkdocs_glightbox/plugin.py", line 151, in wrap_img_with_anchor
    else re.search(r"alt=[\"\']([^\"\']+)", img_attr).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Will attempt to determine which line in the markdown caused this and report once found, but for now, have fixed on 0.3.2

from mkdocs-glightbox.

tgit-hub avatar tgit-hub commented on August 23, 2024

OK, tracked it down to an alt value that starts with a single quote, such as:

alt="'Weird Al' Yankovic"

However, any value that includes a single quote will also not return the full "alt" value, only upto the first single quote. For example:

>>> import re
>>> img_attr="alt=\"Dwayne 'The Rock' Johnson\""
>>> re.search(r"alt=[\"\']([^\"\']+)", img_attr).group(1)
'Dwayne '

from mkdocs-glightbox.

tgit-hub avatar tgit-hub commented on August 23, 2024

Appreciate the prompt update. Now working.

from mkdocs-glightbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.