Skip to content

Commit

Permalink
✨ Feat: add param to hide single code block header (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Jul 24, 2024
1 parent 537ad1d commit de18e91
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions assets/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,12 @@ class FixIt {
$preChroma.parentElement.replaceChild($chroma, $preChroma);
$td.appendChild($preChroma);
});
// render code header
this.util.forEach(document.querySelectorAll('.highlight > .chroma:not([data-init])'), ($chroma) => {
$chroma.dataset.init = 'true';
if ($chroma.parentElement.classList.contains('no-header')) {
return;
}
const $codeElements = $chroma.querySelectorAll('pre.chroma > code');
if ($codeElements.length) {
const $code = $codeElements[$codeElements.length - 1];
Expand Down

0 comments on commit de18e91

Please sign in to comment.