Skip to content

Commit 42084ee

Browse files
committed
fix width, increase toc depth
1 parent 8d11258 commit 42084ee

File tree

7 files changed

+70
-51
lines changed

7 files changed

+70
-51
lines changed

src/generators/jsx-ast/utils/__tests__/buildContent.test.mjs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ import { SAMPLE } from './utils.mjs';
77
import { JSX_IMPORTS } from '../../../web/constants.mjs';
88
import buildContent from '../buildContent.mjs';
99

10-
const expectedNames = [
11-
JSX_IMPORTS.NavBar.name,
12-
JSX_IMPORTS.Article.name,
13-
JSX_IMPORTS.SideBar.name,
14-
];
15-
1610
describe('buildContent', () => {
1711
it('should process entries and include JSX wrapper elements', async () => {
1812
const tree = await buildContent(
@@ -27,12 +21,10 @@ describe('buildContent', () => {
2721
const foundNames = [];
2822
visit(tree, node => node.name && foundNames.push(node.name));
2923

30-
expectedNames.forEach(name => {
31-
assert(
32-
foundNames.includes(name),
33-
`Missing "${name}". Found: ${foundNames.join(', ')}`
34-
);
35-
});
24+
assert.equal(foundNames, [
25+
JSX_IMPORTS.NotificationProvider.name,
26+
JSX_IMPORTS.NavBar.name,
27+
]);
3628

3729
assert.equal(tree.data, SAMPLE);
3830
});

src/generators/jsx-ast/utils/buildBarProps.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const buildMetaBarProps = (head, entries) => {
2626

2727
const headings = entries
2828
.filter(
29-
entry => entry.heading?.data?.text && entry.heading?.data?.depth < 3
29+
entry => entry.heading?.data?.text && entry.heading?.data?.depth < 4
3030
)
3131
.map(entry => {
3232
let heading = getFullName(

src/generators/jsx-ast/utils/transformer.mjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,18 @@ import { TAG_TRANSFORMS } from '../constants.mjs';
88
* @returns {T}
99
*/
1010
const transformer = tree => {
11-
visit(tree, 'element', node => {
11+
visit(tree, 'element', (node, index, parent) => {
1212
node.tagName = TAG_TRANSFORMS[node.tagName] || node.tagName;
13+
14+
// Wrap <table> in a <div class="table-container">
15+
if (node.tagName === 'table' && parent && typeof index === 'number') {
16+
parent.children[index] = {
17+
type: 'element',
18+
tagName: 'div',
19+
properties: { className: ['overflow-container'] },
20+
children: [node],
21+
};
22+
}
1323
});
1424

1525
// Are there footnotes?

src/generators/web/build/bundle.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default async function bundle(code, { server = false } = {}) {
1515
input: 'entrypoint.jsx',
1616
output: {
1717
format: server ? 'cjs' : 'iife',
18-
minify: server ? undefined : true,
18+
minify: !server,
1919
},
2020
platform: server ? 'node' : 'browser',
2121
external: server ? ['preact', '@node-core/ui-components'] : [],

src/generators/web/build/css.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default () => {
5555
this.emitFile({
5656
type: 'asset',
5757
name: 'styles.css',
58-
source: Array.from(cssChunks).join('\n'),
58+
source: Array.from(cssChunks).join(''),
5959
});
6060
},
6161
};

src/generators/web/build/data.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ export const createStaticData = () => {
2525
};
2626
};
2727

28-
const staticData = JSON.stringify(createStaticData());
29-
export default staticData;
28+
export default JSON.stringify(createStaticData());

src/generators/web/ui/index.css

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,58 @@
11
@import '@node-core/ui-components/styles/index.css';
22

3+
/* Fonts */
34
:root {
45
--font-open-sans: 'Open Sans', sans-serif;
56
--font-ibm-plex-mono: 'IBM Plex Mono', monospace;
67
}
78

8-
div:has(> h1, > h2, > h3, > h4) {
9-
display: flex;
10-
align-items: center;
11-
gap: 8px;
12-
}
13-
14-
/* Code should inherit its font size */
15-
code {
16-
font-size: inherit;
17-
}
18-
19-
a {
20-
padding-right: unset;
21-
}
22-
23-
.change-history {
24-
margin-left: auto;
25-
}
26-
27-
.arrow {
28-
width: calc(var(--spacing, 0.25rem) * 3);
29-
display: inline;
30-
margin-left: var(--spacing, 0.25rem);
31-
}
32-
33-
/* No line numbers on signatures */
34-
.signature .line::after {
35-
all: unset !important;
36-
}
37-
38-
.signature .line {
39-
padding-left: unset !important;
40-
}
9+
main {
10+
overflow: hidden;
11+
12+
/* Code should inherit its font size */
13+
code {
14+
font-size: inherit;
15+
}
16+
17+
/* Don't overflow the parent */
18+
.overflow-container {
19+
overflow-x: auto;
20+
width: 100%;
21+
}
22+
23+
table {
24+
/* In tables, don't pad `a` elements */
25+
a {
26+
padding-right: unset;
27+
}
28+
}
29+
30+
/* Change history positioning */
31+
div:has(> h1, > h2, > h3, > h4) {
32+
display: flex;
33+
align-items: center;
34+
gap: 8px;
35+
36+
.change-history {
37+
margin-left: auto;
38+
}
39+
}
40+
41+
.arrow {
42+
/* Arrow icon styling */
43+
width: calc(var(--spacing, 0.25rem) * 3);
44+
display: inline;
45+
margin-left: var(--spacing, 0.25rem);
46+
}
47+
48+
.signature {
49+
/* Signature styling - remove line numbers and padding */
50+
.line {
51+
padding-left: unset !important;
52+
53+
&::after {
54+
all: unset !important;
55+
}
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)