From 822fc4d0ca6f7ab53fede4c709eee9eb7e435d46 Mon Sep 17 00:00:00 2001
From: thiloho <123883702+thiloho@users.noreply.github.com>
Date: Fri, 21 Nov 2025 02:55:53 +0100
Subject: [PATCH] Fix
---
astro.config.ts | 49 ++++++++++++++++++++++++++++++++++++
src/content/index.md | 1 -
src/layouts/PageLayout.astro | 2 +-
src/styles/global.css | 8 ++----
4 files changed, 52 insertions(+), 8 deletions(-)
diff --git a/astro.config.ts b/astro.config.ts
index 7af41e1..bff3b1a 100644
--- a/astro.config.ts
+++ b/astro.config.ts
@@ -4,6 +4,54 @@ import sitemap from "@astrojs/sitemap";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeSlug from "rehype-slug";
+type RehypeNode = {
+ type: string;
+ tagName?: string;
+ children?: RehypeNode[];
+ properties?: {
+ [key: string]: unknown;
+ className?: string[];
+ };
+};
+
+type RehypeParent = RehypeNode & {
+ children: RehypeNode[];
+};
+
+type RehypeRoot = RehypeParent;
+
+const rehypeWrapTables = () => {
+ const visit = (node: RehypeNode, parent: RehypeParent | null) => {
+ if (node.type === "element" && node.tagName === "table" && parent) {
+ const wrapper: RehypeNode = {
+ type: "element",
+ tagName: "div",
+ properties: {
+ className: ["overflow-x-auto", "max-w-full"],
+ },
+ children: [node],
+ };
+
+ const index = parent.children.indexOf(node);
+ if (index !== -1) {
+ parent.children[index] = wrapper;
+ }
+
+ return;
+ }
+
+ if (Array.isArray(node.children)) {
+ for (const child of node.children) {
+ visit(child, node as RehypeParent);
+ }
+ }
+ };
+
+ return (tree: RehypeRoot) => {
+ visit(tree, null);
+ };
+};
+
export default defineConfig({
site: "https://thilohohlt.com",
@@ -27,6 +75,7 @@ export default defineConfig({
behavior: "wrap",
},
],
+ rehypeWrapTables,
],
},
diff --git a/src/content/index.md b/src/content/index.md
index f6bce8d..8c31e3d 100644
--- a/src/content/index.md
+++ b/src/content/index.md
@@ -26,4 +26,3 @@ I am a software developer from Germany who is passionate about building high qua
- [qBittorrent](https://www.qbittorrent.org)
- [Tuta Mail](https://tuta.com)
- [Visual Studio Code](https://code.visualstudio.com)
-
diff --git a/src/layouts/PageLayout.astro b/src/layouts/PageLayout.astro
index 0e85044..d12d3a6 100644
--- a/src/layouts/PageLayout.astro
+++ b/src/layouts/PageLayout.astro
@@ -22,7 +22,7 @@ const { title, description, pubDate, modDate, slug } = Astro.props;
diff --git a/src/styles/global.css b/src/styles/global.css
index 7394d1a..9ef5c62 100644
--- a/src/styles/global.css
+++ b/src/styles/global.css
@@ -33,15 +33,11 @@
}
#software + ul > li {
- @apply list-none !m-0 !p-0;
+ @apply !m-0 list-none !p-0;
}
#software + ul > li a {
- @apply border border-neutral-300 dark:border-neutral-600 px-2 py-1;
- }
-
- table {
- @apply !text-base;
+ @apply border border-neutral-300 px-2 py-1 dark:border-neutral-600;
}
}