Skip to content

Commit

Permalink
feat(patch-detail): show lang tag in highlighted code blocks, increas…
Browse files Browse the repository at this point in the history
…e max-w for them and decrease for normal copy

Signed-off-by: Konstantinos Maninakis <maninak@protonmail.com>
  • Loading branch information
maninak committed Jan 24, 2024
1 parent 258b738 commit 29e36b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/webviews/src/assets/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
}

& > span[class*='hljs-']:first-of-type {
@apply relative
@apply relative;
}
}

Expand Down
12 changes: 7 additions & 5 deletions src/webviews/src/components/PatchDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,22 @@ function checkOutDefaultBranch() {
}
onMounted(() => {
nextTick(()=>{
nextTick(() => {
console.info('mounted')
document.querySelectorAll("code.hljs[class*='language-']").forEach((highlightedCodeEl)=> {
document.querySelectorAll("code.hljs[class*='language-']").forEach((highlightedCodeEl) => {
const highlightedCodeElClass = highlightedCodeEl.classList.value
const langTagEl = document.createElement('span')
langTagEl.textContent = highlightedCodeElClass.replace('hljs ', '').replaceAll(/language-/g,'').trim()
langTagEl.textContent = highlightedCodeElClass
.replace('hljs ', '')
.replaceAll(/language-/g, '')
.trim()
langTagEl.classList.add('langTag')
highlightedCodeEl.insertBefore(langTagEl, highlightedCodeEl.firstChild)
console.info('inserted')
}
)
})
})
})
</script>
Expand Down

0 comments on commit 29e36b5

Please sign in to comment.