reallysimpledocs 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reallysimpledocs",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.js",
@@ -8,6 +8,7 @@ const tableClass = ["table"];
8
8
  export function rehypeBasecoatTables() {
9
9
  return (tree) => {
10
10
  transformTables(tree);
11
+ transformCodeBlocks(tree);
11
12
  };
12
13
  }
13
14
 
@@ -40,6 +41,18 @@ function transformTables(parent) {
40
41
  }
41
42
  }
42
43
 
44
+ function transformCodeBlocks(parent) {
45
+ if (!Array.isArray(parent?.children)) return;
46
+
47
+ for (const child of parent.children) {
48
+ if (isElement(child, "pre") && child.children?.some((node) => isElement(node, "code"))) {
49
+ addClass(child, ["scrollbar"]);
50
+ continue;
51
+ }
52
+ transformCodeBlocks(child);
53
+ }
54
+ }
55
+
43
56
  function isElement(node, tagName) {
44
57
  return node?.type === "element" && node.tagName === tagName;
45
58
  }
@@ -47,7 +47,7 @@
47
47
  @apply block min-w-full w-max px-4 py-3 text-[13px];
48
48
  }
49
49
  pre:has(> code) {
50
- @apply scrollbar max-w-full overflow-x-auto;
50
+ @apply max-w-full overflow-x-auto;
51
51
  }
52
52
  > blockquote {
53
53
  @apply border-l-4 border-border pl-4;
@@ -177,7 +177,7 @@ html.dark .astro-code span {
177
177
  }
178
178
 
179
179
  .tabs-frame > header {
180
- @apply flex items-center gap-2 overflow-x-auto rounded-t-[inherit] border-b bg-muted px-3 py-0.5 text-sm font-medium dark:bg-muted/50;
180
+ @apply flex items-center gap-2 overflow-x-auto rounded-t-[inherit] border-b bg-muted px-3 text-sm font-medium dark:bg-muted/50;
181
181
  scrollbar-width: none;
182
182
  }
183
183
 
@@ -191,7 +191,7 @@ html.dark .astro-code span {
191
191
  }
192
192
 
193
193
  .code-block > pre {
194
- @apply scrollbar my-0 max-w-full overflow-x-auto rounded-none border-0;
194
+ @apply my-0 max-w-full overflow-x-auto rounded-none border-0;
195
195
  }
196
196
 
197
197
  .code-block > pre > code {
@@ -4,6 +4,7 @@
4
4
  @apply rounded-2xl;
5
5
  }
6
6
 
7
- .code-frame > header {
8
- @apply h-[40px];
7
+ .code-frame > header,
8
+ .tabs-frame > header {
9
+ @apply h-[39px];
9
10
  }
@@ -4,6 +4,7 @@
4
4
  @apply rounded-none;
5
5
  }
6
6
 
7
- .code-frame > header {
8
- @apply h-[32px];
7
+ .code-frame > header,
8
+ .tabs-frame > header {
9
+ @apply h-[33px];
9
10
  }
@@ -4,6 +4,7 @@
4
4
  @apply rounded-lg;
5
5
  }
6
6
 
7
- .code-frame > header {
8
- @apply h-[40px];
7
+ .code-frame > header,
8
+ .tabs-frame > header {
9
+ @apply h-[39px];
9
10
  }
@@ -4,6 +4,7 @@
4
4
  @apply rounded-lg;
5
5
  }
6
6
 
7
- .code-frame > header {
8
- @apply h-[32px];
7
+ .code-frame > header,
8
+ .tabs-frame > header {
9
+ @apply h-[33px];
9
10
  }
@@ -4,6 +4,7 @@
4
4
  @apply rounded-lg;
5
5
  }
6
6
 
7
- .code-frame > header {
8
- @apply h-[36px];
7
+ .code-frame > header,
8
+ .tabs-frame > header {
9
+ @apply h-[35px];
9
10
  }
@@ -4,6 +4,7 @@
4
4
  @apply rounded-2xl;
5
5
  }
6
6
 
7
- .code-frame > header {
8
- @apply h-[36px];
7
+ .code-frame > header,
8
+ .tabs-frame > header {
9
+ @apply h-[35px];
9
10
  }
@@ -4,6 +4,7 @@
4
4
  @apply rounded-none;
5
5
  }
6
6
 
7
- .code-frame > header {
8
- @apply h-[40px];
7
+ .code-frame > header,
8
+ .tabs-frame > header {
9
+ @apply h-[41px];
9
10
  }
@@ -4,6 +4,7 @@
4
4
  @apply rounded-lg;
5
5
  }
6
6
 
7
- .code-frame > header {
8
- @apply h-[40px];
7
+ .code-frame > header,
8
+ .tabs-frame > header {
9
+ @apply h-[39px];
9
10
  }