|
|
@ -14,10 +14,15 @@ export function useCopyCode() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const isShell = /language-(shellscript|shell|bash|sh|zsh)/.test(
|
|
|
|
const isShell = /language-(shellscript|shell|bash|sh|zsh)/.test(
|
|
|
|
parent.classList.toString()
|
|
|
|
parent.className
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
let { innerText: text = '' } = sibling
|
|
|
|
let text = ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sibling
|
|
|
|
|
|
|
|
.querySelectorAll('span.line:not(.diff.remove)')
|
|
|
|
|
|
|
|
.forEach((node) => (text += (node.textContent || '') + '\n'))
|
|
|
|
|
|
|
|
text = text.slice(0, -1)
|
|
|
|
|
|
|
|
|
|
|
|
if (isShell) {
|
|
|
|
if (isShell) {
|
|
|
|
text = text.replace(/^ *(\$|>) /gm, '').trim()
|
|
|
|
text = text.replace(/^ *(\$|>) /gm, '').trim()
|
|
|
|