Skip to content

Instantly share code, notes, and snippets.

@abelsromero
Last active March 1, 2022 20:21
Show Gist options
  • Save abelsromero/5393739cdbf458686db5555378781580 to your computer and use it in GitHub Desktop.
Save abelsromero/5393739cdbf458686db5555378781580 to your computer and use it in GitHub Desktop.
How to integrate image popup in Asciidoctor without extensions

This guide shows how to integrate Magnific Popup without custom extensions.

Steps

  1. Download and install Magnific Popup locally.

  2. Create docinfo.html with

    <!-- Magnific Popup core CSS file -->
    <link rel="stylesheet" href="magnific-popup/magnific-popup.css">
    <!-- jQuery 1.7.2+ or Zepto.js 1.0+ -->
    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
    <!-- Magnific Popup core JS file -->
    <script src="magnific-popup/jquery.magnific-popup.min.js"></script>
    <script>
    $(document).ready(function() {
      $('.popup-link').magnificPopup({delegate:'a',type:'image'});
    });
    </script>
  3. Add images with a link as follow

    Note that the role must match the CSS selector in the docinfo ready function.

    image:image-path.jpg[link="image-path.jpg",role="popup-link"]
  4. Render with docinfo1 attribute.

@timothybryant
Copy link

timothybryant commented Mar 1, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment