markawesome 0.10.0 → 0.10.1
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 +6 -0
- data/lib/markawesome/transformers/popover_transformer.rb +11 -4
- data/lib/markawesome/version.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: 467018c4fc1fed8b4f16c0fabc30b74b64b0517a07f1221ae1db9a0f4ae4e13a
|
|
4
|
+
data.tar.gz: 22f81090651a9db046abf659b8874071e25b2bf2cc436a92a2c7404d98ab5560
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de23d695ccadd397f71ff18d99c40a6b9cb61012fd40f95cde7bc7bb85227116aa5fff6768e8baf5ed230b7bf0bd4fca2947a6027eb9c466930542acf686e024
|
|
7
|
+
data.tar.gz: 58b1ca622184a8879a76249d081e9983e30fc135ceb9fd057d03db371f39381dc0bf7789d31701af32c6ceb4f05d22d310a9f3c7c9714b947b1ee03f3a80f76c
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ 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.10.1] - 2026-05-08
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- `PopoverTransformer` no longer emits duplicate `id` attributes when the same popover (identical trigger text and content) appears more than once in a document. Popover IDs were derived solely from `MD5(trigger + content)`, so repeated popovers shared an ID and triggered HTML validators' `no-dup-id` rule. The first occurrence keeps its existing ID for backwards compatibility; subsequent occurrences are suffixed with `-2`, `-3`, etc.
|
|
12
|
+
|
|
7
13
|
## [0.10.0] - 2026-05-05
|
|
8
14
|
|
|
9
15
|
### Added
|
|
@@ -22,6 +22,11 @@ module Markawesome
|
|
|
22
22
|
}.freeze
|
|
23
23
|
|
|
24
24
|
def self.transform(content)
|
|
25
|
+
# Tracks ID base usage within this transform call so repeated popovers
|
|
26
|
+
# (same trigger + content) get disambiguated suffixes instead of
|
|
27
|
+
# colliding on the page.
|
|
28
|
+
seen_ids = Hash.new(0)
|
|
29
|
+
|
|
25
30
|
# Inline regex (single-line, no newlines allowed)
|
|
26
31
|
inline_regex = /&&&[ \t]*([^\r\n]*?)[ \t]*>>>[ \t]*([^\r\n]+?)[ \t]*&&&/
|
|
27
32
|
|
|
@@ -39,7 +44,7 @@ module Markawesome
|
|
|
39
44
|
params_string, trigger_text = parse_inline_trigger_and_params(combined)
|
|
40
45
|
placement, without_arrow, distance, _link_style = parse_parameters(params_string)
|
|
41
46
|
|
|
42
|
-
popover_id = generate_popover_id(trigger_text, popover_content)
|
|
47
|
+
popover_id = generate_popover_id(trigger_text, popover_content, seen_ids)
|
|
43
48
|
|
|
44
49
|
build_inline_popover_html(popover_id, trigger_text, popover_content,
|
|
45
50
|
{ placement: placement, without_arrow: without_arrow,
|
|
@@ -54,7 +59,7 @@ module Markawesome
|
|
|
54
59
|
|
|
55
60
|
placement, without_arrow, distance, link_style = parse_parameters(params_string)
|
|
56
61
|
|
|
57
|
-
popover_id = generate_popover_id(trigger_text, popover_content)
|
|
62
|
+
popover_id = generate_popover_id(trigger_text, popover_content, seen_ids)
|
|
58
63
|
|
|
59
64
|
content_html = markdown_to_html(popover_content)
|
|
60
65
|
|
|
@@ -116,10 +121,12 @@ module Markawesome
|
|
|
116
121
|
[placement, without_arrow, distance, link_style]
|
|
117
122
|
end
|
|
118
123
|
|
|
119
|
-
def generate_popover_id(trigger_text, content)
|
|
124
|
+
def generate_popover_id(trigger_text, content, seen_ids)
|
|
120
125
|
hash_input = "#{trigger_text}#{content}"
|
|
121
126
|
hash = Digest::MD5.hexdigest(hash_input)
|
|
122
|
-
"popover-#{hash[0..7]}"
|
|
127
|
+
base = "popover-#{hash[0..7]}"
|
|
128
|
+
occurrence = seen_ids[base] += 1
|
|
129
|
+
occurrence == 1 ? base : "#{base}-#{occurrence}"
|
|
123
130
|
end
|
|
124
131
|
|
|
125
132
|
def parse_inline_trigger_and_params(combined_string)
|
data/lib/markawesome/version.rb
CHANGED