(FREE SITE GENERATOR) - A Customizable/Hackable portfolio jekyll theme where you can blog using Markdown or CMS :rocket: in minutes built for developers. (with CMS) ✨
Is your feature request related to a problem? Please describe.
The code snippets used in the markdown files are doesn't show the code type mentioned in markdown.
The copy to clipboard option in the top right corner for each code snippets would be a great feature.
Describe the solution you'd like
The code snippets used in the markdown files are getting detected but would love to show what code it is such as bash, javascript, python, php, powershell etc just as mentioned in the markdown.
Also copy to clipboard option in the top right corner for each code snippets (where the button is changed upon click showing as copied with a color change for 3-4 seconds).
Describe alternatives you've considered
I tried to implement the 2nd feature mentioned, but the copy button always ends at the left side bottom inspite of using the css. Please find the code i tried below:
var codeBlocks = document.querySelectorAll('pre.highlight');
codeBlocks.forEach(function (codeBlock) {
var Button = document.createElement('button');
Button.className = ' ';
Button.type = 'button';
Button.ariaLabel = 'Copy code to clipboard';
Button.innerText = 'Copy';
codeBlock.append( Button);
Button.addEventListener('click', function () {
var code = codeBlock.querySelector('code').innerText.trim();
window.navigator.clipboard.writeText(code);
Button.innerText = 'Copied';
var fourSeconds = 4000;
setTimeout(function () {
Button.innerText = 'Copy';
}, fourSeconds);
});
});
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered I tried to implement the 2nd feature mentioned, but the copy button always ends at the left side bottom inspite of using the css. Please find the code i tried below:
Placed the below in the _includes/head.html