Skip to content

Commit f310be5

Browse files
committed
Document and add PDF page-break styles
Update README to describe the Docusaurus-based documentation site, provide development and build commands, and add instructions for generating the documentation PDF locally. Document MDX helper classes for inserting and controlling page breaks in the generated PDF. Implement corresponding CSS in scripts/pdf-style.css (.page-break, .page-break-before, .page-break-after) to enforce page breaks when exporting to PDF.
1 parent 0dc0898 commit f310be5

2 files changed

Lines changed: 76 additions & 3 deletions

File tree

README.md

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,59 @@
11
## Viglet Documentation
2-
Repository with Viglet Documentation
2+
3+
Documentation site for Viglet products, built with [Docusaurus 3](https://docusaurus.io/).
4+
5+
### Development
36

47
```shell
5-
$ cd docs
6-
$ bundle exec jekyll serve
8+
npm install
9+
npm start
710
```
11+
12+
### Build
13+
14+
```shell
15+
npm run build
16+
```
17+
18+
### PDF Generation
19+
20+
The documentation PDF is generated automatically during deploy. To generate locally:
21+
22+
```shell
23+
npm run build
24+
npx docusaurus serve --no-open &
25+
npx wait-on http://localhost:3000/turing/getting-started/intro --timeout 60000
26+
npm run gen-pdf
27+
```
28+
29+
#### Page Breaks in PDF
30+
31+
Use the following classes in MDX files to control page breaks in the generated PDF. These are invisible on the website.
32+
33+
**Force a page break at a specific point:**
34+
35+
```mdx
36+
Some content before the break.
37+
38+
<div className="page-break" />
39+
40+
This starts on a new page in the PDF.
41+
```
42+
43+
**Force an element to start on a new page:**
44+
45+
```mdx
46+
<h2 className="page-break-before">New Section</h2>
47+
```
48+
49+
**Force a page break after an element:**
50+
51+
```mdx
52+
<div className="page-break-after">Last content on this page</div>
53+
```
54+
55+
| Class | Effect |
56+
|---|---|
57+
| `page-break` | Insert a page break at that position |
58+
| `page-break-before` | Element starts on a new page |
59+
| `page-break-after` | Page break after the element |

scripts/pdf-style.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,24 @@ h1, h2, h3 {
315315
pre, table, .admonition, blockquote {
316316
page-break-inside: avoid;
317317
}
318+
319+
/* Manual page break — use <div className="page-break" /> in MDX */
320+
.page-break {
321+
page-break-before: always;
322+
break-before: page;
323+
height: 0;
324+
margin: 0;
325+
padding: 0;
326+
}
327+
328+
/* Force next element to start on a new page */
329+
.page-break-before {
330+
page-break-before: always;
331+
break-before: page;
332+
}
333+
334+
/* Force page break after this element */
335+
.page-break-after {
336+
page-break-after: always;
337+
break-after: page;
338+
}

0 commit comments

Comments
 (0)