Skip to content

Commit c4151a8

Browse files
committed
eat the shell prompt
Signed-off-by: Keith Wall <[email protected]>
1 parent d16db59 commit c4151a8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

_layouts/guide.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ <h1 class="card-title fs-3">
4545
</div>
4646

4747
<script>
48-
<!-- clipboard.js code -->
4948

5049
var allCodeBlocksElements = $( "code" );
5150

5251
allCodeBlocksElements.each(function(i) {
5352

5453
if ($(this).parents('.listingblock').length) {
5554

56-
var currentId = "codeblock" + (i + 1);
57-
$(this).attr('id', currentId);
55+
var code = $(this).text().split(/\n/);
56+
for (var idx = 0; idx < code.length; idx++) { code[idx] = code[idx].replace("$ ", "") }
57+
5858
//trigger
59-
var clipButton = '<button class="btn" data-clipboard-target="#' + currentId + '"><img src="https://clipboardjs.com/assets/images/clippy.svg" width="13" alt="Copy to clipboard"></button>';
60-
$(this).after(clipButton);
59+
var clipButton = '<button class="btn" data-clipboard-text="' + code.join("\n") + '"><img src="https://clipboardjs.com/assets/images/clippy.svg" width="13" alt="Copy to clipboard"></button>';
60+
$(this).parent().before(clipButton);
6161
}
6262
}
6363
);

0 commit comments

Comments
 (0)