Skip to content

Commit 00e7575

Browse files
committed
e2e fix
1 parent 528a4b3 commit 00e7575

File tree

4 files changed

+58
-11
lines changed

4 files changed

+58
-11
lines changed

.changeset/little-icons-buy.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"e2e-tests": patch
3+
---
4+
5+
make e2e test private

apps/docs/getting-started.mdx

+52-11
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ bun dev
5252

5353
This will start a live preview of your documents in your browser.
5454

55+
![Dev server preview](/images/dev-server.png)
56+
5557
## Manual Setup
5658
If you prefer to set up htmldocs manually, follow these steps:
5759

@@ -88,20 +90,59 @@ bun add htmldocs @htmldocs/react @htmldocs/render
8890

8991
3. Create document template
9092

91-
Create a new folder called `documents` in your project. Then, create a new file called `index.tsx` in the `documents` folder and include the following code:
93+
Create a new folder called `documents` in your project. Then, create a new file called `Book.tsx` in the `documents` folder and include the following code:
9294

9395
```tsx
94-
import { Document, Page } from "@htmldocs/react";
95-
96-
export default function MyDocument() {
97-
return (
98-
<Document size="A4" orientation="portrait" margin="0.5in">
99-
<Page style={{ backgroundColor: "#000", color: "#fff" }}>
100-
<h1>Hello from the dark side</h1>
101-
</Page>
102-
</Document>
103-
);
96+
import { Document, Footer } from "@htmldocs/react"
97+
import MarkdownIt from 'markdown-it'
98+
99+
import "~/index.css"
100+
101+
const MARKDOWN_CONTENT = `
102+
# The Art of Programming
103+
104+
## Chapter 1: Fundamentals
105+
106+
Programming is both a science and an art. It requires logical thinking and creative problem-solving. In this book, we will explore the principles that make software development a fascinating discipline.
107+
108+
### 1.1 The Programming Mindset
109+
110+
To become an effective programmer, one must develop a particular way of thinking. This includes:
111+
112+
- Breaking down complex problems into manageable parts
113+
- Thinking algorithmically about solutions
114+
- Understanding data structures and their applications
115+
- Embracing continuous learning and adaptation
116+
117+
The journey of a programmer is one of constant growth and discovery.
118+
`
119+
120+
const md = new MarkdownIt({ html: true })
121+
122+
function Book() {
123+
const html = md.render(MARKDOWN_CONTENT)
124+
125+
return (
126+
<Document size="6in 9in" orientation="portrait" margin="0.75in">
127+
<article className="prose max-w-none font-serif">
128+
<div dangerouslySetInnerHTML={{ __html: html }} />
129+
</article>
130+
131+
<Footer
132+
position="bottom-center"
133+
className="font-serif text-sm"
134+
children={({ currentPage }) => currentPage}
135+
marginBoxStyles={{
136+
marginBottom: '0.25in',
137+
}}
138+
/>
139+
</Document>
140+
)
104141
}
142+
143+
Book.documentId = "book"
144+
145+
export default Book
105146
```
106147

107148
4. Run the development server by running:

apps/docs/images/dev-server.png

425 KB
Loading

packages/e2e-tests/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "e2e-tests",
3+
"private": true,
34
"version": "1.0.1",
45
"description": "End-to-end tests for htmldocs",
56
"scripts": {

0 commit comments

Comments
 (0)