jekyll-webawesome 0.2.1 → 0.3.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f09b4ba8c46c0b7691411998aea6960e82dbe53654c95c777361b53876ecc19c
|
4
|
+
data.tar.gz: 125a368ad99787b0dbec1901781bd1c7fa2fcfdc0c1b14fe2440f8cfe9ad119a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc8e69fcd0869698e5b9e8ce3225ab219be8b50eb781beab64a4b7ad0571d4e2580189a4607b6254f52ed7e1fa1cb776b44c7c7443f9e50785cd45fe7d75c83a
|
7
|
+
data.tar.gz: a27a198436f697ff26959c06b73eba4f52e72164f400251517487f0242a3c959f126a15088f3c91b86ae3c6e3dcb6645c9fcaaf12f6ac1bfb5a084170b540a9d
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
- Placeholder
|
10
|
+
|
11
|
+
## [0.3.0] - 2025-09-29
|
12
|
+
|
13
|
+
- Support for wa-copy-button component (`<<<...<<<` or `:::wa-copy-button`)
|
14
|
+
|
9
15
|
## [0.2.1] - 2025-09-23
|
10
16
|
|
11
17
|
- Fixed issues with icon transformation messing up code blocks and inline code
|
data/README.md
CHANGED
@@ -17,6 +17,7 @@ This plugin focuses on the most commonly used Web Awesome components for Jekyll
|
|
17
17
|
| **Callouts** | `:::info` | `:::wa-callout info` | `<wa-callout variant="brand"><wa-icon name="circle-info"></wa-icon>content</wa-callout>` |
|
18
18
|
| **Card** | `===` | `:::wa-card` | `<wa-card>content</wa-card>` |
|
19
19
|
| **Comparison** | `\|\|\|` or `\|\|\|25` | `:::wa-comparison` or `:::wa-comparison 25` | `<wa-comparison>` with before/after slots |
|
20
|
+
| **Copy Button** | `<<<` | `:::wa-copy-button` | `<wa-copy-button value="content">content</wa-copy-button>` |
|
20
21
|
| **Details** | `^^^` | `:::wa-details` | `<wa-details><summary>summary</summary>content</wa-details>` |
|
21
22
|
| **Tab Group** | `++++++` | `:::wa-tabs` | `<wa-tab-group><wa-tab>content</wa-tab></wa-tab-group>` |
|
22
23
|
| **Tag** | `@@@brand` | `:::wa-tag brand` | `<wa-tag variant="brand">content</wa-tag>` |
|
@@ -27,7 +28,6 @@ These content-focused components will get dedicated syntax in future releases:
|
|
27
28
|
|
28
29
|
| Component | Primary Syntax | Alternative syntax | HTML Output |
|
29
30
|
|-----------|----------------------|-------------------|-------------|
|
30
|
-
| **Copy Button** | `<<<` | `:::wa-copy-button` | `<wa-copy-button>content</wa-copy-button>` |
|
31
31
|
| **Icon** | `$$$icon-name` | `:::wa-icon name` | `<wa-icon name="icon-name"></wa-icon>` |
|
32
32
|
| **Progress Bar** | `&&&value` | `:::wa-progress-bar value` | `<wa-progress-bar value="50"></wa-progress-bar>` |
|
33
33
|
| **Rating** | `???value` | `:::wa-rating value` | `<wa-rating value="4"></wa-rating>` |
|
@@ -294,6 +294,44 @@ These transform into Web Awesome tag components with appropriate colors and styl
|
|
294
294
|
|
295
295
|

|
296
296
|
|
297
|
+
### Copy Buttons
|
298
|
+
|
299
|
+
Create copy-to-clipboard buttons using the `<<<` syntax:
|
300
|
+
|
301
|
+
```markdown
|
302
|
+
<<<
|
303
|
+
Copy this simple text
|
304
|
+
<<<
|
305
|
+
|
306
|
+
<<<
|
307
|
+
npm install jekyll-webawesome
|
308
|
+
<<<
|
309
|
+
```
|
310
|
+
|
311
|
+
Copy buttons support **markdown formatting** in the display text while preserving the original markdown in the clipboard value:
|
312
|
+
|
313
|
+
```markdown
|
314
|
+
<<<
|
315
|
+
**Copy** this text with *markdown* formatting and `code`
|
316
|
+
<<<
|
317
|
+
```
|
318
|
+
|
319
|
+
This transforms into a Web Awesome copy button component:
|
320
|
+
|
321
|
+
```html
|
322
|
+
<wa-copy-button value="**Copy** this text with *markdown* formatting and `code`"></wa-copy-button>
|
323
|
+
```
|
324
|
+
|
325
|
+
Copy buttons work well for:
|
326
|
+
|
327
|
+
- Code snippets and commands
|
328
|
+
- URLs and configuration values
|
329
|
+
- Installation instructions
|
330
|
+
- API keys or tokens
|
331
|
+
- Any text users might want to copy
|
332
|
+
|
333
|
+
> **Note**: The `value` attribute contains the raw text (including any markdown) that gets copied to the clipboard. The copy button displays the standard Web Awesome copy icon and handles the clipboard operation automatically.
|
334
|
+
|
297
335
|
### Details/Summary (Collapsible Content)
|
298
336
|
|
299
337
|
Create collapsible content using the `^^^` syntax:
|
@@ -14,6 +14,7 @@ module Jekyll
|
|
14
14
|
content = CalloutTransformer.transform(content)
|
15
15
|
content = CardTransformer.transform(content)
|
16
16
|
content = ComparisonTransformer.transform(content)
|
17
|
+
content = CopyButtonTransformer.transform(content)
|
17
18
|
content = DetailsTransformer.transform(content)
|
18
19
|
content = IconTransformer.transform(content)
|
19
20
|
content = TagTransformer.transform(content)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base_transformer'
|
4
|
+
|
5
|
+
module Jekyll
|
6
|
+
module WebAwesome
|
7
|
+
# Transforms copy button syntax into wa-copy-button elements
|
8
|
+
# Primary syntax: <<<\ncontent\n<<<
|
9
|
+
# Alternative syntax: :::wa-copy-button\ncontent\n:::
|
10
|
+
#
|
11
|
+
# Usage:
|
12
|
+
# <<<
|
13
|
+
# This text will be copied to clipboard
|
14
|
+
# <<<
|
15
|
+
#
|
16
|
+
# :::wa-copy-button
|
17
|
+
# Copy this text
|
18
|
+
# :::
|
19
|
+
class CopyButtonTransformer < BaseTransformer
|
20
|
+
def self.transform(content)
|
21
|
+
# Define both regex patterns
|
22
|
+
primary_regex = /^<<<\n(.*?)\n<<</m
|
23
|
+
alternative_regex = /^:::wa-copy-button\n(.*?)\n:::/m
|
24
|
+
|
25
|
+
# Define shared transformation logic
|
26
|
+
transform_proc = proc do |copy_content|
|
27
|
+
copy_content = copy_content.strip
|
28
|
+
|
29
|
+
build_copy_button_html(copy_content)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Apply both patterns
|
33
|
+
patterns = dual_syntax_patterns(primary_regex, alternative_regex, transform_proc)
|
34
|
+
apply_multiple_patterns(content, patterns)
|
35
|
+
end
|
36
|
+
|
37
|
+
class << self
|
38
|
+
private
|
39
|
+
|
40
|
+
def build_copy_button_html(content)
|
41
|
+
# Escape the content for the value attribute
|
42
|
+
escaped_content = content.gsub('"', '"').gsub("'", ''')
|
43
|
+
|
44
|
+
"<wa-copy-button value=\"#{escaped_content}\"></wa-copy-button>"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -9,6 +9,7 @@ require_relative 'transformers/button_transformer'
|
|
9
9
|
require_relative 'transformers/callout_transformer'
|
10
10
|
require_relative 'transformers/card_transformer'
|
11
11
|
require_relative 'transformers/comparison_transformer'
|
12
|
+
require_relative 'transformers/copy_button_transformer'
|
12
13
|
require_relative 'transformers/details_transformer'
|
13
14
|
require_relative 'transformers/icon_transformer'
|
14
15
|
require_relative 'transformers/tabs_transformer'
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janne Waren
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- lib/jekyll/webawesome/transformers/callout_transformer.rb
|
124
124
|
- lib/jekyll/webawesome/transformers/card_transformer.rb
|
125
125
|
- lib/jekyll/webawesome/transformers/comparison_transformer.rb
|
126
|
+
- lib/jekyll/webawesome/transformers/copy_button_transformer.rb
|
126
127
|
- lib/jekyll/webawesome/transformers/details_transformer.rb
|
127
128
|
- lib/jekyll/webawesome/transformers/icon_transformer.rb
|
128
129
|
- lib/jekyll/webawesome/transformers/tabs_transformer.rb
|