Skip to content

Commit 2e19f01

Browse files
committed
Add copy button for dotted config properties
1 parent db90a71 commit 2e19f01

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

_plugins/asciidoctor-extension.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@
5252
end
5353
end
5454

55+
Extensions.register do
56+
inline_macro do
57+
named :config_property_copy_button
58+
resolve_attributes false
59+
process do |parent, target, attrs|
60+
config_property = target.tr('"', '\"')
61+
copy_btn = %(<button class="btn-copy fa fa-clipboard inline-btn-copy" data-clipboard-action="copy" data-clipboard-text="#{config_property}" title="Copy to clipboard" do-not-collapse="true"></button>)
62+
config_property_id += 1
63+
create_inline_pass parent, %(#{copy_btn})
64+
end
65+
end
66+
end
5567

5668
### ALL CONFIG page processors
5769

0 commit comments

Comments
 (0)