jekyll-webawesome 0.15.0 → 0.17.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eed7bec14cb14b78a96929ed9674a7863027188e5ddd9135ebad4754098f99ce
4
- data.tar.gz: 5e1b26bd64f32c5bd956745dd3c557acf14fdf79ede90dfced47e7166c423241
3
+ metadata.gz: 9c27e972cb87e87f8e44664d928d6c719ff0b376f02831a4e19716cfc37f35ce
4
+ data.tar.gz: 3966e4dff919a36fc16ae0a63faac13efbda2cc588b4aa3ac52d14d3e6e94daa
5
5
  SHA512:
6
- metadata.gz: 8f78a369900c6b38547a2431dab95ee5c2eb0a342ab7390f5577d282aa38e9acd1f96102f71c2650785eede96a3dfde10f99b82e0881471c17c4306137d8db81
7
- data.tar.gz: 0d9dd06c86ff39b0c37706e2e4d392683cc3d0b0095ceab5b373199c2c0b9b43e0c44e2ea9dec9a1ed53b995a35d0e4e1f9d1601ceeaf066d41a3dbbd7c5d136
6
+ metadata.gz: b64548599839abefb2847dfe34353c3e3bae2a3ded97dad5ab4e4428c5731885f487bc6a611e297ba5f9e2dca9fa42f9765ae15e9a65d5f97a42fdc36ba8a290
7
+ data.tar.gz: 2c116837ef14f254793b40065aa97ccc09c2ef5acf6d3469a765548fbaffd9e314dd255fa3a78ddee52e3e6e138f9524db97dc9c92bfdac48a3f1756133a3567
data/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
6
6
 
7
+ ## [0.17.0] - 2026-06-16
8
+
9
+ ### Changed
10
+
11
+ - Updated `markawesome` dependency to `~> 0.11`, which aligns generated markup with Web Awesome 3.8.0. This fixes four invalid attribute values that previously fell back to wrong defaults (dialog footer button `variant='primary'`, dialog image-trigger and popover trigger `variant='text'`, details `appearance='filled outlined'`) and adds the Web Awesome 3.x size scale (`xs`/`s`/`m`/`l`/`xl`) for buttons, callouts, and tags plus `4xl`/`5xl` layout gap tokens.
12
+
13
+ ### Added
14
+
15
+ - Example site now demonstrates the Web Awesome 3.x size scale (`xs`–`xl`) for callouts, tags, and buttons, and the `4xl`/`5xl` layout gaps.
16
+
17
+ ## [0.16.0] - 2026-05-05
18
+
19
+ ### Changed
20
+
21
+ - Internal: code block protection (replacing fenced code blocks with placeholders before Markawesome transforms run, so `:::info`/`^^^`/`@@@` examples inside fenced code stay intact) is now delegated to `Markawesome::CodeBlockProtector` instead of being implemented locally. The Jekyll-specific `{% highlight %}` substitution at priority 15 stays in this gem. No behavior change for Jekyll users.
22
+ - Updated `markawesome` dependency to `~> 0.10`. The 0.10.0 release adds `Markawesome::PlainMarkdownRenderer` (an alternate renderer that emits clean GFM instead of HTML) and exposes `Markawesome::CodeBlockProtector` as a public helper.
23
+
7
24
  ## [0.15.0] - 2026-03-12
8
25
 
9
26
  ### Added
@@ -33,9 +33,8 @@ Gem::Specification.new do |spec|
33
33
  spec.require_paths = ['lib']
34
34
 
35
35
  spec.add_dependency 'jekyll', '>= 3.7', '< 5.0'
36
- spec.add_dependency 'markawesome', '~> 0.9'
36
+ spec.add_dependency 'markawesome', '~> 0.11'
37
37
 
38
- spec.add_development_dependency 'bundler', '~> 2.0'
39
38
  spec.add_development_dependency 'rake', '~> 13.0'
40
39
  spec.add_development_dependency 'rspec', '~> 3.0'
41
40
  spec.add_development_dependency 'rubocop', '~> 1.0'
@@ -1,71 +1,61 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'markawesome/code_block_protector'
4
+
3
5
  module Jekyll
4
6
  module WebAwesome
5
- # Transforms markdown code blocks to Jekyll highlight syntax
7
+ # Protects markdown fenced code blocks before Markawesome transforms
8
+ # run, and substitutes them with Jekyll `{% highlight %}` tags after,
9
+ # so code examples containing `:::`/`^^^`/`@@@` survive intact and
10
+ # language-tagged blocks still render with Jekyll's syntax highlighter.
11
+ #
12
+ # Protection/restore is delegated to Markawesome::CodeBlockProtector;
13
+ # the `{% highlight %}` substitution at priority 15 is Jekyll-specific
14
+ # and stays here.
6
15
  module CodeBlockTransformer
7
- CODE_BLOCK_PATTERN = /```([a-zA-Z0-9.+#_-]+)?(\n.*?)```/m
16
+ CODE_BLOCK_PATTERN = Markawesome::CodeBlockProtector::CODE_BLOCK_PATTERN
8
17
 
9
- # Class variable to store protected blocks across hook calls
10
- @@protected_blocks = {}
18
+ @protected_blocks = {}
11
19
 
12
20
  class << self
21
+ attr_reader :protected_blocks
22
+
13
23
  def clear_protected_blocks
14
- @@protected_blocks.clear
24
+ @protected_blocks.clear
15
25
  end
16
26
 
17
27
  # Check if pages transformation is enabled
18
28
  def transform_pages_enabled?(site)
19
- # Check plugin configuration first
20
29
  return Jekyll::WebAwesome.configuration.transform_pages if Jekyll::WebAwesome.configuration
21
-
22
- # Check site config
23
30
  return site.config.dig('webawesome', 'transform_pages') if site.config.dig('webawesome', 'transform_pages') != nil
24
31
 
25
- # Default to true
26
32
  true
27
33
  end
28
34
 
29
35
  # Check if documents transformation is enabled
30
36
  def transform_documents_enabled?(site)
31
- # Check plugin configuration first
32
37
  return Jekyll::WebAwesome.configuration.transform_documents if Jekyll::WebAwesome.configuration
33
-
34
- # Check site config
35
38
  return site.config.dig('webawesome', 'transform_documents') if site.config.dig('webawesome', 'transform_documents') != nil
36
39
 
37
- # Default to true
38
40
  true
39
41
  end
40
42
 
41
- # Check if a code block contains WebAwesome syntax that should be preserved
42
- def contains_webawesome_syntax?(content)
43
- # Check for WebAwesome patterns
44
- callout_pattern = /^:::(info|success|neutral|warning|danger)/m
45
- details_pattern = /^\^\^\^/m
46
- tabs_pattern = /^\+{6}/m
47
-
48
- content.match?(callout_pattern) || content.match?(details_pattern) || content.match?(tabs_pattern)
49
- end
50
-
51
- # Protect all code blocks by converting them to placeholders
52
- # This prevents markdown processing from corrupting code blocks inside custom elements
43
+ # Protect all code blocks by converting them to placeholders via
44
+ # Markawesome::CodeBlockProtector. The resulting token map is
45
+ # merged into @protected_blocks so per-page placeholders survive
46
+ # across the pre_render priority chain (50 → 15 → 10).
53
47
  def protect_all_code_blocks(content)
54
- counter = @@protected_blocks.size
55
-
56
- content.gsub(CODE_BLOCK_PATTERN) do |match|
57
- placeholder = "<!--PROTECTED_CODE_BLOCK_#{counter}-->"
58
- @@protected_blocks[placeholder] = match
59
- counter += 1
60
- placeholder
61
- end
48
+ protected_content, tokens = Markawesome::CodeBlockProtector.protect(content)
49
+ @protected_blocks.merge!(tokens)
50
+ protected_content
62
51
  end
63
52
 
64
- # Transform code blocks from markdown syntax to Jekyll highlight tags
65
- # This should be called AFTER WebAwesome transformers have processed the content
53
+ # Rewrite each protected fenced block to a Jekyll `{% highlight %}`
54
+ # tag, except for blocks without a language or with `plain` — those
55
+ # are restored verbatim. Called at priority 15, i.e. after
56
+ # Markawesome transformers but before restore.
66
57
  def transform_code_blocks(content)
67
- # Transform code blocks that were previously protected
68
- @@protected_blocks.transform_values! do |match|
58
+ @protected_blocks.transform_values! do |match|
69
59
  if match =~ CODE_BLOCK_PATTERN
70
60
  language = Regexp.last_match(1)
71
61
  code_content = Regexp.last_match(2).strip
@@ -73,7 +63,7 @@ module Jekyll
73
63
  if language && language.downcase != 'plain'
74
64
  "{% highlight #{language} %}\n#{code_content}\n{% endhighlight %}"
75
65
  else
76
- match # Return original block if no language or 'plain'
66
+ match
77
67
  end
78
68
  else
79
69
  match
@@ -82,12 +72,14 @@ module Jekyll
82
72
  content
83
73
  end
84
74
 
85
- # Restore protected WebAwesome example blocks after WaElementTransformer processing
75
+ # Restore protected code blocks using Markawesome::CodeBlockProtector,
76
+ # then clear the per-page token map so the next page starts fresh.
77
+ # CodeBlockProtector.protect always restarts its counter at 0, so
78
+ # clearing between pages prevents placeholder-id collisions.
86
79
  def restore_protected_blocks(content)
87
- @@protected_blocks.each do |placeholder, original_block|
88
- content = content.gsub(placeholder, original_block)
89
- end
90
- content
80
+ restored = Markawesome::CodeBlockProtector.restore(content, @protected_blocks)
81
+ @protected_blocks.clear
82
+ restored
91
83
  end
92
84
 
93
85
  def process(content)
@@ -95,15 +87,11 @@ module Jekyll
95
87
  end
96
88
  end
97
89
 
98
- # Register hooks directly in the transformer module
99
- # Wrapped in conditional to prevent errors when Jekyll::Hooks is not fully loaded
100
90
  if defined?(Jekyll::Hooks)
101
- # Clear protected blocks at start of build
102
91
  Jekyll::Hooks.register :site, :pre_render do |_site|
103
92
  CodeBlockTransformer.clear_protected_blocks
104
93
  end
105
94
 
106
- # STEP 1: Protect all code blocks BEFORE any transformations (highest priority)
107
95
  Jekyll::Hooks.register :documents, :pre_render, priority: 50 do |document|
108
96
  next unless document.relative_path =~ /.*\.md$/i
109
97
  next unless CodeBlockTransformer.transform_documents_enabled?(document.site)
@@ -120,8 +108,6 @@ module Jekyll
120
108
  page.content = CodeBlockTransformer.protect_all_code_blocks(page.content)
121
109
  end
122
110
 
123
- # STEP 2: Transform protected code blocks to Jekyll highlight syntax
124
- # This happens AFTER WebAwesome transformers (priority 20) but BEFORE restoration
125
111
  Jekyll::Hooks.register :documents, :pre_render, priority: 15 do |document|
126
112
  next unless document.relative_path =~ /.*\.md$/i
127
113
  next unless CodeBlockTransformer.transform_documents_enabled?(document.site)
@@ -138,7 +124,6 @@ module Jekyll
138
124
  page.content = CodeBlockTransformer.transform_code_blocks(page.content)
139
125
  end
140
126
 
141
- # STEP 3: Restore protected blocks after transformation (lowest priority)
142
127
  Jekyll::Hooks.register :documents, :pre_render, priority: 10 do |document|
143
128
  next unless document.relative_path =~ /.*\.md$/i
144
129
  next unless CodeBlockTransformer.transform_documents_enabled?(document.site)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module WebAwesome
5
- VERSION = '0.15.0'
5
+ VERSION = '0.17.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-webawesome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janne Waren
@@ -35,28 +35,14 @@ dependencies:
35
35
  requirements:
36
36
  - - "~>"
37
37
  - !ruby/object:Gem::Version
38
- version: '0.9'
38
+ version: '0.11'
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
42
42
  requirements:
43
43
  - - "~>"
44
44
  - !ruby/object:Gem::Version
45
- version: '0.9'
46
- - !ruby/object:Gem::Dependency
47
- name: bundler
48
- requirement: !ruby/object:Gem::Requirement
49
- requirements:
50
- - - "~>"
51
- - !ruby/object:Gem::Version
52
- version: '2.0'
53
- type: :development
54
- prerelease: false
55
- version_requirements: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '2.0'
45
+ version: '0.11'
60
46
  - !ruby/object:Gem::Dependency
61
47
  name: rake
62
48
  requirement: !ruby/object:Gem::Requirement
@@ -138,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
124
  - !ruby/object:Gem::Version
139
125
  version: '0'
140
126
  requirements: []
141
- rubygems_version: 4.0.3
127
+ rubygems_version: 4.0.10
142
128
  specification_version: 4
143
129
  summary: Jekyll plugin for Web Awesome components
144
130
  test_files: []