markawesome 0.5.0 → 0.7.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: c1a813451ca32ebe286489c510fd9ebc0f161877d6e20bdc50c390c8e54669c8
4
- data.tar.gz: fe1f091910a15ebf1f825769266fdaa1ff776e1ceace7a041e0fe71370b42817
3
+ metadata.gz: bd4d3d594adb8f57319bfbb9b353d9e1557cf9949417a4da62bd2e8e5f736ed3
4
+ data.tar.gz: e1018086c23e3c38f24312fb5a16c5194260083253e17100c7d591a9c93de25f
5
5
  SHA512:
6
- metadata.gz: 1ddf1bc53111ca053bd5fe82040ee9387783dd95f0892658697a2f38f0b7a11ebd8fa1517df4e990fbda8aaa90f465f27bb1a6f46d673b8f6fc31a24acab5070
7
- data.tar.gz: 83ac02b6ca5cb7744579661c068511c53666bf4ec8b550a6170050ab04f8911c053db46f1b87122b91aec2024b3a564f4e21d1a34e49189fdbb0e5152df99e49
6
+ metadata.gz: f3934636dd055cd7e418b276a1eae04f06f4c5a7527213ea6e59cdfd907cd8e9db0874a71790255891a559b907360889202205b36c15d6fa6b2a8c9454ab9c73
7
+ data.tar.gz: 83627f19b8439b91f2e2ac241cab1061546b2d50b267aa1096c2a3b96b4ee7b561d3bb53628cbeed2f285a07205331653fd1b6200d746cc0c2362bcfa7333bef
data/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ 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.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.7.0] - 2026-02-16
8
+
9
+ ### Added
10
+
11
+ - **IconTransformer: Size support** — Append a size token to control icon font-size via inline style. Primary syntax uses `:` separator (`$$$settings:lg`), alternative syntax uses space (`:::wa-icon settings lg`). Available sizes: `xs` (0.75em), `sm` (0.875em), `lg` (1.25em), `xl` (1.5em), `2x` (2em), `3x` (3em), `4x` (4em)
12
+ - **IconTransformer: Custom SVG icons** — Use a file path starting with `/` or `./` to render `<wa-icon src="...">` instead of `<wa-icon name="...">`. Supports sizes too (`$$$/assets/icons/shoe.svg:2x`)
13
+
14
+ ## [0.6.0] - 2026-02-14
15
+
16
+ ### Changed
17
+
18
+ - **BREAKING: Card header syntax** — Card headers now use `**bold text**` instead of `# heading`. The first bold-only line inside a card block becomes the header slot. This avoids markdownlint warnings about multiple top-level headings (MD025) and incorrect heading levels (MD001), and better reflects that card titles are not semantic document headings.
19
+
7
20
  ## [0.5.0] - 2026-02-10
8
21
 
9
22
  ### Added
data/README.md CHANGED
@@ -10,22 +10,91 @@ Used as the transformation engine for the [jekyll-webawesome](https://github.com
10
10
  - 🚀 **Simple Syntax** - Clean, intuitive Markdown extensions
11
11
  - ⚙️ **Configurable** - Customize icons, variants, and component behavior
12
12
 
13
- ## Supported components
13
+ ## Supported Components
14
14
 
15
15
  | Component | Primary Syntax | Alternative Syntax | HTML Output |
16
16
  |-----------|----------------|-------------------|-------------|
17
17
  | **Badge** | `!!!variant` | `:::wa-badge variant` | `<wa-badge variant="brand">content</wa-badge>` |
18
18
  | **Button** | `%%%variant` | `:::wa-button variant` | `<wa-button variant="brand" href="url">text</wa-button>` or `<wa-button variant="brand">text</wa-button>` |
19
- | **Callouts** | `:::info` | `:::wa-callout info` | `<wa-callout variant="brand"><wa-icon name="circle-info"></wa-icon>content</wa-callout>` |
19
+ | **Callout** | `:::info` | `:::wa-callout info` | `<wa-callout variant="brand"><wa-icon ...></wa-icon>content</wa-callout>` |
20
20
  | **Card** | `===` | `:::wa-card` | `<wa-card>content</wa-card>` |
21
21
  | **Carousel** | `~~~~~~` | `:::wa-carousel` | `<wa-carousel>` with carousel items |
22
22
  | **Comparison** | `\|\|\|` or `\|\|\|25` | `:::wa-comparison` or `:::wa-comparison 25` | `<wa-comparison>` with before/after slots |
23
23
  | **Copy Button** | `<<<` | `:::wa-copy-button` | `<wa-copy-button value="content">content</wa-copy-button>` |
24
- | **Details** | `^^^appearance? icon-placement?` | `:::wa-details appearance? icon-placement?` | `<wa-details appearance="..." icon-placement="...">content</wa-details>` |
24
+ | **Details** | `^^^appearance? icon-placement?` | `:::wa-details appearance? icon-placement?` | `<wa-details>content</wa-details>` |
25
25
  | **Dialog** | `???params?` | `:::wa-dialog params?` | `<wa-dialog>` with trigger button and content |
26
+ | **Icon** | `$$$icon-name` or `$$$icon-name:size` | `:::wa-icon icon-name [size]` | `<wa-icon name="icon-name"></wa-icon>` |
27
+ | **Image Dialog** | `![alt](url)` | — | Wraps images in clickable `<wa-dialog>` overlays |
26
28
  | **Tab Group** | `++++++` | `:::wa-tabs` | `<wa-tab-group><wa-tab>content</wa-tab></wa-tab-group>` |
27
29
  | **Tag** | `@@@brand` | `:::wa-tag brand` | `<wa-tag variant="brand">content</wa-tag>` |
28
30
 
31
+ ## Icon
32
+
33
+ ### Named icons
34
+
35
+ Use a Web Awesome icon name:
36
+
37
+ ```markdown
38
+ Click $$$settings to configure.
39
+ A large $$$home:lg icon.
40
+ ```
41
+
42
+ ### Custom SVG icons
43
+
44
+ Point to a local SVG file by starting the path with `/` or `./`:
45
+
46
+ ```markdown
47
+ $$$/assets/icons/shoe.svg
48
+ $$$/assets/icons/shoe.svg:2x
49
+ $$$./icons/logo.svg:xl
50
+ ```
51
+
52
+ This outputs `<wa-icon src="/assets/icons/shoe.svg"></wa-icon>` instead of using the `name` attribute.
53
+
54
+ ### Sizes
55
+
56
+ Append a size token after `:` (primary syntax) or as a space-separated parameter (alternative syntax):
57
+
58
+ | Token | CSS `font-size` |
59
+ |-------|----------------|
60
+ | `xs` | 0.75em |
61
+ | `sm` | 0.875em |
62
+ | `lg` | 1.25em |
63
+ | `xl` | 1.5em |
64
+ | `2x` | 2em |
65
+ | `3x` | 3em |
66
+ | `4x` | 4em |
67
+
68
+ Without a size token, the icon inherits the surrounding font size.
69
+
70
+ ## Layout Utilities
71
+
72
+ Layout utilities use `::::` (quadruple colon) syntax to wrap content in CSS layout containers. Inner content is not markdown-converted, so component `:::` syntax inside layouts works normally.
73
+
74
+ | Layout | Primary Syntax | Alternative Syntax | HTML Output |
75
+ |--------|----------------|-------------------|-------------|
76
+ | **Grid** | `::::grid` | `::::wa-grid` | `<div class="wa-grid">content</div>` |
77
+ | **Stack** | `::::stack` | `::::wa-stack` | `<div class="wa-stack">content</div>` |
78
+ | **Cluster** | `::::cluster` | `::::wa-cluster` | `<div class="wa-cluster">content</div>` |
79
+ | **Split** | `::::split` | `::::wa-split` | `<div class="wa-split">content</div>` |
80
+ | **Flank** | `::::flank` | `::::wa-flank` | `<div class="wa-flank">content</div>` |
81
+ | **Frame** | `::::frame` | `::::wa-frame` | `<div class="wa-frame">content</div>` |
82
+
83
+ ### Common layout attributes
84
+
85
+ All layouts support these key:value attributes:
86
+
87
+ - `gap:SIZE` — Sets spacing (`0`, `3xs`, `2xs`, `xs`, `s`, `m`, `l`, `xl`, `2xl`, `3xl`)
88
+ - `align:VALUE` — Align items (`start`, `end`, `center`, `stretch`, `baseline`)
89
+ - `justify:VALUE` — Justify content (`start`, `end`, `center`, `space-between`, `space-around`, `space-evenly`)
90
+
91
+ ### Layout-specific attributes
92
+
93
+ - **Grid**: `min:CSS_VALUE` — Minimum column size (e.g., `min:200px`)
94
+ - **Split**: `row` or `column` — Direction modifier
95
+ - **Flank**: `start` or `end` — Position modifier; `size:CSS_VALUE`, `content:PCT`
96
+ - **Frame**: `landscape`, `portrait`, or `square` — Aspect ratio; `radius:SIZE` (`s`, `m`, `l`, `pill`, `circle`, `square`)
97
+
29
98
  ## Installation
30
99
 
31
100
  Add this line to your application's Gemfile:
@@ -10,6 +10,7 @@ module Markawesome
10
10
  # Supported attributes:
11
11
  # appearance: outlined (default), filled, filled-outlined, plain, accent
12
12
  # orientation: vertical (default), horizontal
13
+ # Card header: first **bold** line (not a heading) becomes the header slot
13
14
  class CardTransformer < BaseTransformer
14
15
  CARD_ATTRIBUTES = {
15
16
  appearance: %w[outlined filled filled-outlined plain accent],
@@ -57,11 +58,11 @@ module Markawesome
57
58
  content = content.sub(/^!\[([^\]]*)\]\(([^)]+)\)\n?/, '')
58
59
  end
59
60
 
60
- # Extract first heading as header
61
- if content.match(/^# (.+)$/)
61
+ # Extract first bold line as header
62
+ if content.match(/^\*\*(.+)\*\*$/)
62
63
  parts[:header] = ::Regexp.last_match(1).strip
63
- # Remove the heading from content
64
- content = content.sub(/^# .+\n?/, '')
64
+ # Remove the bold line from content
65
+ content = content.sub(/^\*\*(.+)\*\*\n?/, '')
65
66
  end
66
67
 
67
68
  # Extract trailing buttons/links as footer
@@ -4,30 +4,46 @@ require_relative 'base_transformer'
4
4
 
5
5
  module Markawesome
6
6
  # Transforms icon syntax into wa-icon elements
7
- # Primary syntax: $$$icon-name
8
- # Alternative syntax: :::wa-icon icon-name
7
+ # Primary syntax: $$$icon-name or $$$icon-name:size
8
+ # Custom SVG syntax: $$$/path/to/icon.svg or $$$/path/to/icon.svg:size
9
+ # Alternative syntax: :::wa-icon icon-name [size] or :::wa-icon /path/to/icon.svg [size]
9
10
  #
10
11
  # Examples:
11
12
  # $$$settings -> <wa-icon name="settings"></wa-icon>
12
- # $$$home -> <wa-icon name="home"></wa-icon>
13
- # $$$user-circle -> <wa-icon name="user-circle"></wa-icon>
13
+ # $$$settings:lg -> <wa-icon name="settings" style="font-size: 1.25em;"></wa-icon>
14
+ # $$$/assets/icons/shoe.svg -> <wa-icon src="/assets/icons/shoe.svg"></wa-icon>
15
+ # $$$/assets/icons/shoe.svg:2x -> <wa-icon src="/assets/icons/shoe.svg" style="font-size: 2em;"></wa-icon>
16
+ #
17
+ # Available sizes: xs (0.75em), sm (0.875em), lg (1.25em), xl (1.5em), 2x (2em), 3x (3em), 4x (4em)
14
18
  class IconTransformer < BaseTransformer
19
+ SIZES = {
20
+ 'xs' => '0.75em',
21
+ 'sm' => '0.875em',
22
+ 'lg' => '1.25em',
23
+ 'xl' => '1.5em',
24
+ '2x' => '2em',
25
+ '3x' => '3em',
26
+ '4x' => '4em'
27
+ }.freeze
28
+
15
29
  def self.transform(content)
16
30
  # Protect code blocks first
17
31
  protected_content, code_blocks = protect_code_blocks(content)
18
32
 
19
33
  # Apply primary syntax transformation
20
- # Only block patterns that look like incomplete icon names:
21
- # $$$icon name (where 'icon name' could be intended as one identifier)
22
- result = protected_content.gsub(/\$\$\$([a-zA-Z0-9\-_]+)(?![a-zA-Z0-9\-_]|\s+name\b)/) do
23
- icon_name = ::Regexp.last_match(1)
24
- build_icon_html(icon_name)
34
+ # Supports named icons ($$$settings:lg) and custom SVG paths ($$$/path/to/icon.svg:2x)
35
+ result = protected_content.gsub(%r{\$\$\$(\.?/[a-zA-Z0-9\-_./]+|[a-zA-Z0-9\-_]+)(?::([a-zA-Z0-9]+))?(?![a-zA-Z0-9\-_]|\s+name\b)}) do
36
+ icon_ref = ::Regexp.last_match(1)
37
+ size = ::Regexp.last_match(2)
38
+ build_icon_html(icon_ref, size)
25
39
  end
26
40
 
27
41
  # Apply alternative syntax transformation
28
- result = result.gsub(/:::wa-icon\s+([a-zA-Z0-9\-_]+)\s*\n:::/m) do
29
- icon_name = ::Regexp.last_match(1)
30
- build_icon_html(icon_name)
42
+ # Supports named icons and custom SVG paths with optional size
43
+ result = result.gsub(%r{:::wa-icon\s+(\.?/[a-zA-Z0-9\-_./]+|[a-zA-Z0-9\-_]+)(?:\s+([a-zA-Z0-9]+))?\s*\n:::}m) do
44
+ icon_ref = ::Regexp.last_match(1)
45
+ size = ::Regexp.last_match(2)
46
+ build_icon_html(icon_ref, size)
31
47
  end
32
48
 
33
49
  # Restore code blocks
@@ -37,12 +53,20 @@ module Markawesome
37
53
  class << self
38
54
  private
39
55
 
40
- def build_icon_html(icon_name)
41
- # Clean and validate icon name
42
- clean_name = icon_name.strip
56
+ def build_icon_html(icon_ref, size = nil)
57
+ clean_ref = icon_ref.strip
58
+
59
+ # Paths (starting with / or ./) use src attribute, otherwise use name
60
+ attr = if clean_ref.include?('/')
61
+ "src=\"#{clean_ref}\""
62
+ else
63
+ "name=\"#{clean_ref}\""
64
+ end
65
+
66
+ # Build style attribute for size
67
+ style = SIZES[size] ? " style=\"font-size: #{SIZES[size]};\"" : ''
43
68
 
44
- # Return the wa-icon element
45
- "<wa-icon name=\"#{clean_name}\"></wa-icon>"
69
+ "<wa-icon #{attr}#{style}></wa-icon>"
46
70
  end
47
71
 
48
72
  def protect_code_blocks(content)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Markawesome
4
- VERSION = '0.5.0'
4
+ VERSION = '0.7.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markawesome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janne Waren