jekyll-gfm-admonitions 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -7
- data/lib/jekyll-gfm-admonitions.rb +19 -14
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 256820fe6bdbfbbc0126d749dd40c452fe5a427a68d4d0214435bd7d626585d2
         | 
| 4 | 
            +
              data.tar.gz: ae6b4e10f370c68a552239d7ffa47cae58a4cfabaa672ccee10d0ea488651a56
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: cbb64978e02ef1359719666c14c4c12d3de465e5af5eb69a8c4656a887ca7a923ce037d6f057c72481f44ad55430d8d1facc161ad9c1568c387e87e85b13455a
         | 
| 7 | 
            +
              data.tar.gz: 4646e448f77f52e31a06d525b340635d1398d1fc32d2b0ff8509eb90d2340a396e9b934dfb5d01a36b191e9499104bd68f1879650d91c71b9a6fa677eede90c9
         | 
    
        data/README.md
    CHANGED
    
    | @@ -29,8 +29,9 @@ The following admonitions are supported: | |
| 29 29 | 
             
            To use admonitions in your markdown files, simply add the following syntax:
         | 
| 30 30 |  | 
| 31 31 | 
             
            ```markdown
         | 
| 32 | 
            -
            > [!NOTE] | 
| 32 | 
            +
            > [!NOTE]
         | 
| 33 33 | 
             
            > Highlights information that users should take into account, even when skimming.
         | 
| 34 | 
            +
            > And supports multi-line text.
         | 
| 34 35 |  | 
| 35 36 | 
             
            > [!TIP]
         | 
| 36 37 | 
             
            > Optional information to help a user be more successful.
         | 
| @@ -38,15 +39,18 @@ To use admonitions in your markdown files, simply add the following syntax: | |
| 38 39 | 
             
            > [!IMPORTANT]  
         | 
| 39 40 | 
             
            > Crucial information necessary for users to succeed.
         | 
| 40 41 |  | 
| 41 | 
            -
            > [!WARNING]  
         | 
| 42 | 
            -
            > Critical content demanding immediate | 
| 42 | 
            +
              > [!WARNING]  
         | 
| 43 | 
            +
              > Critical content demanding immediate
         | 
| 44 | 
            +
              > user attention due to potential risks.
         | 
| 43 45 |  | 
| 44 46 | 
             
            > [!CAUTION]
         | 
| 45 47 | 
             
            > Negative potential consequences of an action.
         | 
| 48 | 
            +
            > Opportunity to provide more context.
         | 
| 46 49 | 
             
            ```
         | 
| 47 50 |  | 
| 48 | 
            -
            > [!NOTE] | 
| 51 | 
            +
            > [!NOTE]
         | 
| 49 52 | 
             
            > Highlights information that users should take into account, even when skimming.
         | 
| 53 | 
            +
            > And supports multi-line text.
         | 
| 50 54 |  | 
| 51 55 | 
             
            > [!TIP]
         | 
| 52 56 | 
             
            > Optional information to help a user be more successful.
         | 
| @@ -54,11 +58,13 @@ To use admonitions in your markdown files, simply add the following syntax: | |
| 54 58 | 
             
            > [!IMPORTANT]  
         | 
| 55 59 | 
             
            > Crucial information necessary for users to succeed.
         | 
| 56 60 |  | 
| 57 | 
            -
            > [!WARNING]  
         | 
| 58 | 
            -
            > Critical content demanding immediate | 
| 61 | 
            +
              > [!WARNING]  
         | 
| 62 | 
            +
              > Critical content demanding immediate
         | 
| 63 | 
            +
              > user attention due to potential risks.
         | 
| 59 64 |  | 
| 60 65 | 
             
            > [!CAUTION]
         | 
| 61 66 | 
             
            > Negative potential consequences of an action.
         | 
| 67 | 
            +
            > Opportunity to provide more context.
         | 
| 62 68 |  | 
| 63 69 | 
             
            #### Custom titles
         | 
| 64 70 |  | 
| @@ -179,4 +185,6 @@ for details. | |
| 179 185 |  | 
| 180 186 | 
             
            ## Contributing
         | 
| 181 187 |  | 
| 182 | 
            -
             | 
| 188 | 
            +
             | 
| 189 | 
            +
            > [!TIP]
         | 
| 190 | 
            +
            > Contributions are welcome! Please feel free to submit issues or pull requests.
         | 
| @@ -73,6 +73,12 @@ module JekyllGFMAdmonitions | |
| 73 73 | 
             
                end
         | 
| 74 74 |  | 
| 75 75 | 
             
                def process_doc(doc)
         | 
| 76 | 
            +
                  # Return early if content is empty
         | 
| 77 | 
            +
                  return if doc.content.empty?
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                  # If the content is frozen, we need to duplicate it so that we can modify it
         | 
| 80 | 
            +
                  doc.content = doc.content.dup unless doc.content.frozen?
         | 
| 81 | 
            +
             | 
| 76 82 | 
             
                  code_blocks = []
         | 
| 77 83 | 
             
                  # Temporarily replace code blocks by a tag, so that we don't process any admonitions
         | 
| 78 84 | 
             
                  # inside of code blocks.
         | 
| @@ -90,26 +96,25 @@ module JekyllGFMAdmonitions | |
| 90 96 | 
             
                end
         | 
| 91 97 |  | 
| 92 98 | 
             
                def convert_admonitions(doc)
         | 
| 93 | 
            -
                  doc.content.gsub!( | 
| 94 | 
            -
                     | 
| 95 | 
            -
                     | 
| 96 | 
            -
             | 
| 97 | 
            -
                     | 
| 98 | 
            -
                      title = type.capitalize
         | 
| 99 | 
            -
                    end
         | 
| 100 | 
            -
                    text = ::Regexp.last_match(3).gsub(/^>\s*/, '').strip
         | 
| 101 | 
            -
                    icon = Octicons::Octicon.new(ADMONITION_ICONS[type]).to_svg
         | 
| 102 | 
            -
                    Jekyll.logger.debug 'GFMA:', "Converting #{type} admonition."
         | 
| 99 | 
            +
                  doc.content.gsub!(/^(\s*)>\s*\[!(IMPORTANT|NOTE|WARNING|TIP|CAUTION)\]([^\n]*)\n((?:\1\s*>\s*[^\n]*(?:\n|$))(?:(?!\s*>\s*\[!)\1\s*>\s*[^\n]*(?:\n|$))*)/) do
         | 
| 100 | 
            +
                    initial_indent = ::Regexp.last_match(1)
         | 
| 101 | 
            +
                    type = ::Regexp.last_match(2).downcase
         | 
| 102 | 
            +
                    title = ::Regexp.last_match(3).strip.empty? ? type.capitalize : ::Regexp.last_match(3).strip
         | 
| 103 | 
            +
                    text = ::Regexp.last_match(4).gsub(/^#{Regexp.escape(initial_indent)}\s*>\s*/, '').strip
         | 
| 103 104 |  | 
| 105 | 
            +
                    icon = Octicons::Octicon.new(ADMONITION_ICONS[type]).to_svg
         | 
| 104 106 | 
             
                    admonition_html(type, title, text, icon)
         | 
| 105 107 | 
             
                  end
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                  # 🛠 Ensure a blank line exists after each admonition block to prevent Markdown parsing issues.
         | 
| 110 | 
            +
                  doc.content.gsub!(/(<\/div>)(?!\n\n)/, "\\1\n\n")
         | 
| 106 111 | 
             
                end
         | 
| 107 112 |  | 
| 108 113 | 
             
                def admonition_html(type, title, text, icon)
         | 
| 109 | 
            -
                  "<div class='markdown-alert markdown-alert-#{type}'>
         | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 114 | 
            +
                  "<div class='markdown-alert markdown-alert-#{type}'>" \
         | 
| 115 | 
            +
                    "<p class='markdown-alert-title'>#{icon} #{title}</p>" \
         | 
| 116 | 
            +
                    "#{@markdown.convert(text)}" \
         | 
| 117 | 
            +
                  "</div>"
         | 
| 113 118 | 
             
                end
         | 
| 114 119 | 
             
              end
         | 
| 115 120 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: jekyll-gfm-admonitions
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.1. | 
| 4 | 
            +
              version: 1.1.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Robin De Schepper
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2025- | 
| 11 | 
            +
            date: 2025-03-03 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: cssminify
         |