code-block-label or code-block-id #623
camilogarciabotero
started this conversation in
Feature Requests
Replies: 2 comments
-
No we don't currently have this option but will definitely consider adding it! |
Beta Was this translation helpful? Give feedback.
0 replies
-
I don't have much JS experience so this is hacky, but I've got this script embedded in my quarto documents. It finds the code block language string and adds a
document.addEventListener("DOMContentLoaded", function() {
var codeBlocks = document.querySelectorAll("pre.sourceCode");
codeBlocks.forEach(function(codeBlock) {
var langTag = document.createElement('p');
langTag.className = "lang-tag";
langTag.textContent = codeBlock.className.split(' ')[1];
codeBlock.parentNode.insertBefore(langTag, codeBlock);
});
})
div p.lang-tag {
margin: 0.2rem;
text-align: left;
font-size: 0.8rem;
font-weight: bolder;
color: var(--quarto-hl-co-color);
} Happy to work on a PR for this, but would need some pointers on integrating this into quarto. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
Thank you for working so hard on the awesome Quarto. I was playing around with it and wondered if there was a feature to label or mark the code blocks after the language it displays. Here is an example of an
R
code block.Cheers.
Beta Was this translation helpful? Give feedback.
All reactions