Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): wrap div that follow docs direction around the code elements #1051

Merged
14 changes: 14 additions & 0 deletions www/src/components/docs/pageContent.astro
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,17 @@ const isRtl = getIsRtlFromLangCode((lang || "en") as KnownLanguageCode);
}
});
</script>
<script>
const main = () => {
const notACodeBlock = ":not(pre) code";
const codeElements = document.querySelectorAll(notACodeBlock);

codeElements.forEach((codeElement) => {
const codeWrapper = document.createElement("div");
codeElement.parentNode?.insertBefore(codeWrapper, codeElement);

codeWrapper.appendChild(codeElement);
});
};
main();
</script>
4 changes: 2 additions & 2 deletions www/src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@
@apply break-words [direction:ltr] [unicode-bidi:embed] lg:break-normal;
}

.markdown code:not(.markdown pre code) {
@apply rounded border border-t3-purple-200 bg-t3-purple-200/40 px-0.5 py-[0.5px] dark:border-t3-purple-400/30 dark:bg-t3-purple-400/20;
.markdown div:has( > code) {
@apply inline rounded border border-t3-purple-200 bg-t3-purple-200/40 px-0.5 py-[0.5px] dark:border-t3-purple-400/30 dark:bg-t3-purple-400/20;
}

.markdown .remark-code-title {
Expand Down