fixed Syntax highlighting behaving wrongly for some languages
Some checks failed
Build, Tag, Push Docker Image / build (push) Has been cancelled
Create Release / Generate Release (push) Has been cancelled

This commit is contained in:
Mia Rose Winter 2024-03-19 16:17:52 +01:00
parent eed9ed554d
commit d825ebdc4f
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
3 changed files with 8 additions and 5 deletions

View file

@ -99,12 +99,12 @@
</template> </template>
<script> <script>
async function copyCode(event) { async function copyCode(event) {
const container = event.srcElement.closest("div").querySelector("code, pre"); const container = event.srcElement.closest("pre, div").querySelector("code, pre");
let text = container.innerText; let text = container.innerText;
await navigator.clipboard.writeText(text); await navigator.clipboard.writeText(text);
} }
document.querySelectorAll(".prose pre, .prose code").forEach((block) => { document.querySelectorAll(".prose div > pre, .prose pre > code").forEach((block) => {
// only add a button if browser supports Clipboard API // only add a button if browser supports Clipboard API
if (navigator.clipboard) { if (navigator.clipboard) {
block.parentElement.classList.add("relative"); block.parentElement.classList.add("relative");

View file

@ -45,7 +45,10 @@ @layer components {
mask-image: linear-gradient(black, black 80%, rgba(0, 0, 0, 0.5) 85%, transparent 100%); mask-image: linear-gradient(black, black 80%, rgba(0, 0, 0, 0.5) 85%, transparent 100%);
} }
.prose pre, .prose code { .prose div > pre, .prose > pre {
@apply bg-neutral-200 text-black rounded-none border-current border-2; @apply bg-inherit text-inherit rounded-none;
}
.prose pre:has(code) {
@apply border-2 border-current;
} }
} }

File diff suppressed because one or more lines are too long