jekyll-webawesome 0.5.3 → 0.5.4
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/CHANGELOG.md +11 -0
- data/README.md +16 -1
- data/lib/jekyll/webawesome/plugin.rb +27 -0
- data/lib/jekyll/webawesome/transformer.rb +1 -1
- data/lib/jekyll/webawesome/transformers/image_dialog_transformer.rb +9 -3
- data/lib/jekyll/webawesome/version.rb +1 -1
- data/lib/jekyll/webawesome.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4151360850db59b840cd6c2fa516b04e34d35bbb801267a2db536fd7ef7220b0
|
4
|
+
data.tar.gz: a80f3fcdf769f017376b7efac94a94370efc8659124f4f06c44eefbae7a46596
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfb4e8b772c1ccfb06a576689cb3fc6cdfd73039feffb6bd665df066f3d6b396ae39acb6d8239d25e82f6e414210e6b41c6982155d6001b1ea5dbbf075ef918e
|
7
|
+
data.tar.gz: d13ced83c839e51da9e6a4d20485d32301adba87ae5ade88371e3308d34b626af96f899a5ccfef4de0f7c960f6fc597a7ce967932250979b5289f457bc5efa1f
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
8
8
|
|
9
9
|
- Placeholder
|
10
10
|
|
11
|
+
## [0.5.4] - 2025-10-20
|
12
|
+
|
13
|
+
- Support for default width for the image_dialog like
|
14
|
+
|
15
|
+
```yaml
|
16
|
+
webawesome:
|
17
|
+
image_dialog:
|
18
|
+
enabled: true
|
19
|
+
default_width: 90vh
|
20
|
+
```
|
21
|
+
|
11
22
|
## [0.5.3] - 2025-10-20
|
12
23
|
|
13
24
|
- Always have a header with X button on the dialogs
|
data/README.md
CHANGED
@@ -69,7 +69,13 @@ webawesome:
|
|
69
69
|
transform_documents: true # Transform documents (like blog posts in _posts)
|
70
70
|
|
71
71
|
# Enable automatic image-to-dialog transformation (default: false)
|
72
|
+
# Can be a simple boolean
|
72
73
|
image_dialog: true # Makes all images clickable and open in dialogs
|
74
|
+
|
75
|
+
# Or a hash with options for more control
|
76
|
+
image_dialog:
|
77
|
+
enabled: true # Enable the feature
|
78
|
+
default_width: 90vh # Default width for dialogs (e.g., 90vh, 80%, 1200px)
|
73
79
|
```
|
74
80
|
|
75
81
|
And then execute:
|
@@ -622,7 +628,13 @@ Enable automatic image-to-dialog transformation in your `_config.yml`:
|
|
622
628
|
|
623
629
|
```yaml
|
624
630
|
webawesome:
|
631
|
+
# Simple boolean to enable
|
625
632
|
image_dialog: true
|
633
|
+
|
634
|
+
# Or configure with options
|
635
|
+
image_dialog:
|
636
|
+
enabled: true
|
637
|
+
default_width: 90vh # Default width for all image dialogs
|
626
638
|
```
|
627
639
|
|
628
640
|
When enabled, all markdown images automatically become clickable and open in full-size dialogs:
|
@@ -631,7 +643,9 @@ When enabled, all markdown images automatically become clickable and open in ful
|
|
631
643
|

|
632
644
|
```
|
633
645
|
|
634
|
-
**
|
646
|
+
**Default Width**: Set a default width for all image dialogs in the configuration. Images will use this width unless overridden in the title.
|
647
|
+
|
648
|
+
**Control dialog width** by adding a width parameter to the title (overrides default):
|
635
649
|
|
636
650
|
```markdown
|
637
651
|
 # Dialog width: 50%
|
@@ -651,6 +665,7 @@ Supported width units: `px`, `em`, `rem`, `vw`, `vh`, `%`, `ch`
|
|
651
665
|
|
652
666
|
- Light-dismiss and headerless dialogs for clean UX
|
653
667
|
- Thumbnail displays at original size, dialog shows full-size
|
668
|
+
- Configurable default width for consistent sizing
|
654
669
|
|
655
670
|
### Tab Placements
|
656
671
|
|
@@ -52,6 +52,33 @@ module Jekyll
|
|
52
52
|
false
|
53
53
|
end
|
54
54
|
|
55
|
+
# Get image dialog configuration with default width support
|
56
|
+
def self.image_dialog_config(site)
|
57
|
+
config = {}
|
58
|
+
|
59
|
+
# First check if it's enabled
|
60
|
+
enabled_config = nil
|
61
|
+
if Jekyll::WebAwesome.configuration
|
62
|
+
enabled_config = Jekyll::WebAwesome.configuration.image_dialog
|
63
|
+
elsif site.config.dig('webawesome', 'image_dialog') != nil
|
64
|
+
enabled_config = site.config.dig('webawesome', 'image_dialog')
|
65
|
+
end
|
66
|
+
|
67
|
+
# If disabled or not set, return empty config
|
68
|
+
return config unless enabled_config
|
69
|
+
|
70
|
+
# If it's a boolean true, set enabled
|
71
|
+
if enabled_config == true
|
72
|
+
config[:enabled] = true
|
73
|
+
# If it's a hash, merge it
|
74
|
+
elsif enabled_config.is_a?(Hash)
|
75
|
+
config = enabled_config.transform_keys(&:to_sym)
|
76
|
+
config[:enabled] = true unless config.key?(:enabled)
|
77
|
+
end
|
78
|
+
|
79
|
+
config
|
80
|
+
end
|
81
|
+
|
55
82
|
# Check if a file is a markdown file
|
56
83
|
def self.markdown_file?(filepath)
|
57
84
|
filepath.to_s.match?(/\.md$/i)
|
@@ -18,7 +18,7 @@ module Jekyll
|
|
18
18
|
content = DetailsTransformer.transform(content)
|
19
19
|
|
20
20
|
# Apply image dialog transformer BEFORE dialog transformer so it can generate dialog syntax
|
21
|
-
content = ImageDialogTransformer.transform(content) if site && Plugin.image_dialog_enabled?(site)
|
21
|
+
content = ImageDialogTransformer.transform(content, site) if site && Plugin.image_dialog_enabled?(site)
|
22
22
|
|
23
23
|
content = DialogTransformer.transform(content)
|
24
24
|
content = IconTransformer.transform(content)
|
@@ -9,7 +9,10 @@ module Jekyll
|
|
9
9
|
# Images can opt-out by adding "nodialog" to the title attribute
|
10
10
|
# Example: 
|
11
11
|
class ImageDialogTransformer < BaseTransformer
|
12
|
-
def self.transform(content)
|
12
|
+
def self.transform(content, site = nil)
|
13
|
+
# Get configuration including default width
|
14
|
+
config = site ? Plugin.image_dialog_config(site) : {}
|
15
|
+
|
13
16
|
# First, protect code blocks, inline code, and comparison blocks from transformation
|
14
17
|
protected_content, fenced_code_blocks = protect_fenced_code_blocks(content)
|
15
18
|
protected_content, inline_code_blocks = protect_inline_code(protected_content)
|
@@ -31,7 +34,7 @@ module Jekyll
|
|
31
34
|
match
|
32
35
|
else
|
33
36
|
# Transform to clickable image with dialog
|
34
|
-
transform_to_dialog(alt_text, image_url, title)
|
37
|
+
transform_to_dialog(alt_text, image_url, title, config)
|
35
38
|
end
|
36
39
|
end
|
37
40
|
|
@@ -115,9 +118,12 @@ module Jekyll
|
|
115
118
|
|
116
119
|
# Transform image into our custom dialog syntax
|
117
120
|
# This will be processed by DialogTransformer to create the actual wa-dialog
|
118
|
-
def transform_to_dialog(alt_text, image_url, title)
|
121
|
+
def transform_to_dialog(alt_text, image_url, title, config = {})
|
119
122
|
# Parse width from title if specified (e.g., "50%", "800px", "60vw")
|
120
123
|
width = extract_width_from_title(title)
|
124
|
+
|
125
|
+
# Use default width from config if no width specified in title
|
126
|
+
width ||= config[:default_width] if config[:default_width]
|
121
127
|
|
122
128
|
# Build dialog parameters
|
123
129
|
# Always include header with X close button for accessibility
|
data/lib/jekyll/webawesome.rb
CHANGED
@@ -31,7 +31,7 @@ module Jekyll
|
|
31
31
|
@custom_components = {}
|
32
32
|
@transform_pages = true
|
33
33
|
@transform_documents = true
|
34
|
-
@image_dialog = false # Opt-in by default for safety
|
34
|
+
@image_dialog = false # Opt-in by default for safety, or can be a hash with options
|
35
35
|
end
|
36
36
|
|
37
37
|
private
|