Skip to content

Commit 26ca6d9

Browse files
committed
Add copy button for dotted config properties
1 parent db90a71 commit 26ca6d9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ asciidoctor:
100100
icons: font
101101
outfilesuffix: ''
102102
add-copy-button-to-env-var: true
103+
add-config-property-copy-button: true
103104

104105
# Pages permalink
105106
defaults:

_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+
config_property_id=0
56+
Extensions.register do
57+
inline_macro do
58+
named :config_property_copy_button
59+
resolve_attributes false
60+
process do |parent, target, attrs|
61+
copy_btn = %(<button class="btn-copy fa fa-clipboard inline-btn-copy" data-clipboard-action="copy" data-clipboard-target="#config-property-#{config_property_id}" 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)