Skip to content

Commit 3fff576

Browse files
committed
updated examples
1 parent bcf41a1 commit 3fff576

File tree

2 files changed

+85
-121
lines changed

2 files changed

+85
-121
lines changed

README.md

Lines changed: 59 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@ A robust, modern documentation viewer built for rendering Markdown files with ad
1313
## Quick Start
1414

1515
### Development Setup
16-
[Fork this Repo](https://github.com/litruv/Docs-Viewer/fork)
16+
17+
[Fork this Repo](https://github.com/example/Docs-Viewer/fork)
1718

1819
#### Updating
20+
1921
##### From GitHub
22+
2023
On your own repo,
24+
2125
1. Click Sync fork
2226
2. Update branch
27+
2328
##### From CLI
29+
2430
```sh
2531
git fetch upstream
2632
git merge upstream/master
@@ -34,31 +40,31 @@ Deploy anywhere that serves static files. For local development:
3440
VSCode:
3541
[LiveServer](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) and hit start server in the docs-viewer directory
3642

37-
Rawdogging it with notepad:
43+
Command Line:
44+
3845
```sh
3946
npx live-server
4047
```
4148

49+
#### Cloudflare Pages
4250

43-
#### Cloudflare Pages
44-
45-
1. Create a new repository on GitHub.
46-
2. Push your code to the repository.
47-
3. Go to [Cloudflare Pages](https://pages.cloudflare.com/) and connect your GitHub repository.
48-
4. Configure the build settings:
49-
* **Production branch:** `main` (or your main branch name)
50-
* **Build command:** Leave empty
51-
* **Build output directory:** `/` (root)
52-
5. Save and deploy.
51+
1. Create a new repository on GitHub.
52+
2. Push your code to the repository.
53+
3. Go to [Cloudflare Pages](https://pages.cloudflare.com/) and connect your GitHub repository.
54+
4. Configure the build settings:
55+
- **Production branch:** `main` (or your main branch name)
56+
- **Build command:** Leave empty
57+
- **Build output directory:** `/` (root)
58+
5. Save and deploy.
5359

5460
##### Optional: Cloudflare Worker for OG/Twitter Tags
5561

5662
For improved SEO and social sharing, you can use a Cloudflare Worker to dynamically generate OG/Twitter tags.
5763

58-
1. Create a new Cloudflare Worker using the code in `cloudflare-worker.js`.
59-
2. Set the `SITE_URL` environment variable to where your site will be located, eg. `https://lit.ruv.wtf/docs/`
60-
3. Set the `DOCS_URL` environment variable to the URL where your documentation files are hosted (usually your Cloudflare Pages URL).
61-
4. Configure a route in your Cloudflare account to route all requests to your Cloudflare Pages site through the worker.
64+
1. Create a new Cloudflare Worker using the code in `cloudflare-worker.js`.
65+
2. Set the `SITE_URL` environment variable to where your site will be located, e.g., `https://example.com/docs/`
66+
3. Set the `DOCS_URL` environment variable to the URL where your documentation files are hosted (usually your Cloudflare Pages URL).
67+
4. Configure a route in your Cloudflare account to route all requests to your Cloudflare Pages site through the worker.
6268

6369
## Project Structure
6470

@@ -72,13 +78,12 @@ For improved SEO and social sharing, you can use a Cloudflare Worker to dynamica
7278
└── styles.css # Theme customization
7379
```
7480

75-
## Configuration
81+
## Configuration
7682

7783
Configure your documentation site with a top-level index file named `index.json`. At minimum, include a `title`, a `defaultPage`, and a list of `documents`:
7884

7985
```json
8086
{
81-
"title": "My Documentation Site",
8287
"defaultPage": "welcome",
8388
"documents": [
8489
{
@@ -90,124 +95,81 @@ Configure your documentation site with a top-level index file named `index.json`
9095
}
9196
```
9297

93-
> If you want to quickly get started, copy `example.index.json` to `index.json` in the project root of your own repository:
98+
> If you want to quickly get started, copy `example.index.json` to `index.json` in the project root:
9499
95100
```sh
96101
cp example.index.json index.json
97102
```
98103

99104
Then adjust the `title`, `defaultPage`, and `documents` array to match your needs.
100105

101-
After placing your `index.json` in the project root, the application will:
102-
103-
1. Apply your site `title` to the browser tab and page header.
104-
2. Load the `defaultPage` when no slug is specified in the URL.
105-
3. Generate a navigation tree from the array of `documents`.
106-
107106
### Root Configuration Options
108107

109-
| Option | Type | Description |
110-
|---------------|--------|----------------------------------------------------------|
111-
| `title` | string | Title of your documentation site |
112-
| `defaultPage` | string | Slug of the page to show when no page is specified |
113-
| `documents` | array | Array of document or folder entries (see below) |
108+
| Option | Type | Description | |
109+
| ------------- | ------ | -------------------------------------------------- | - |
110+
| `defaultPage` | string | Slug of the page to show when no page is specified | |
111+
| `documents` | array | Array of document or folder entries (see below) | |
114112

115113
### Folder Organization
116114

117115
Folders can contain nested documents or subfolders. Mark a folder by setting `"type": "folder"`. Example:
118116

119117
```json
120118
{
121-
"title": "My Documentation Site",
122-
"defaultPage": "welcome",
123-
"documents": [
119+
"title": "Core Concepts",
120+
"type": "folder",
121+
"path": "docs/core-concepts/index.md",
122+
"slug": "core-concepts",
123+
"defaultOpen": true,
124+
"icon": "fa-solid fa-book",
125+
"color": "#01beef
126+
"items": [
124127
{
125-
"title": "Core Concepts",
126-
"type": "folder",
127-
"defaultOpen": true,
128-
"icon": "fa-solid fa-book",
129-
"path": "docs/core-concepts/index.md",
130-
"slug": "core-concepts",
131-
"items": [
132-
{
133-
"title": "Getting Started",
134-
"path": "docs/guides/getting-started.md",
135-
"slug": "getting-started"
136-
}
137-
]
128+
"title": "Getting Started",
129+
"path": "docs/guides/getting-started.md",
130+
"slug": "getting-started"
138131
}
139132
]
140133
}
141134
```
142135

143136
#### Folder Configuration Options
144137

145-
| Option | Type | Description |
146-
|-----------------|----------|----------------------------------------------------|
147-
| `type` | string | Set to `"folder"` for a directory node |
148-
| `title` | string | Display name of the folder |
149-
| `path` | string? | Optional content file path |
150-
| `slug` | string | URL-friendly identifier; required if `path` exists|
151-
| `items` | array | Nested documents or folders |
152-
| `defaultOpen` | boolean? | Automatically expand this folder in the sidebar |
153-
| `icon` | string? | Custom Font Awesome classes |
138+
| Option | Type | Description |
139+
| ------------- | -------- | -------------------------------------------------- |
140+
| `title` | string | Display name of the folder |
141+
| `type` | string | Set to `"folder"` for a directory node |
142+
| `path` | string? | Optional content file path |
143+
| `slug` | string | URL-friendly identifier; required if `path` exists |
144+
| `defaultOpen` | boolean? | Automatically expand this folder in the sidebar |
145+
| `icon` | string? | Custom Font Awesome classes |
146+
| `items` | array | Nested documents or folders |
154147

155148
## Metadata Configuration
156149

150+
> To be used with the cloudflare-worker.js
151+
157152
You can include a "metadata" object in `index.json` to provide:
153+
158154
- Site-wide title and short description
159155
- Thumbnail for social sharing
160156
- Display name for your site
161157

162158
```json
163159
"metadata": {
164-
"title": "Litruv / Documentation",
165-
"description": "Documentation for Litruv's plugins",
160+
"site_name": "MyDocs"
161+
"description": "Documentation for my project",
166162
"thumbnail": "img/og-image.png",
167-
"site_name": "Litruv"
168163
}
169164
```
170165

171166
#### Metadata Configuration Options
172167

173-
| Option | Type | Description |
174-
|---------------|--------|----------------------------------------------------------|
175-
| `title` | string | Title of your documentation site |
176-
| `description` | string | Description of your documentation site |
177-
| `thumbnail` | string | URL to a thumbnail image for social sharing |
178-
| `site_name` | string | Display name for your site |
179-
180-
181-
## Additional Author Info
182-
183-
You can add an "author" object in your `index.json` to display your name, role, and social links:
184-
185-
```json
186-
"author": {
187-
"name": "Litruv",
188-
"role": "Dev/Tech Artist @MatesMedia",
189-
"socials": [
190-
{
191-
"icon": "fab fa-github",
192-
"url": "https://github.com/Litruv",
193-
"title": "GitHub - Litruv"
194-
},
195-
{
196-
"icon": "fab fa-youtube",
197-
"url": "https://www.youtube.com/c/Litruv",
198-
"title": "YouTube - Litruv"
199-
}
200-
]
201-
}
202-
```
203-
204-
## Technology Stack
205-
206-
Built with modern web technologies and carefully selected dependencies:
207-
208-
- [marked](https://github.com/markedjs/marked) - Markdown processing
209-
- [highlight.js](https://highlightjs.org/) - Syntax highlighting
210-
- [Font Awesome](https://fontawesome.com/) - UI iconography
168+
| Option | Type | Description |
169+
| ------------- | ------ | ------------------------------------------- |
170+
| `site_name` | string | Display name for your site |
171+
| `description` | string | Description of your documentation site |
172+
| `thumbnail` | string | URL to a thumbnail image for social sharing |
211173

212174
## License
213175

@@ -216,3 +178,4 @@ Released under the MIT License. See [LICENSE](LICENSE) for details.
216178
## Contributing
217179

218180
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.
181+

example.index.json

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,61 @@
11
{
2-
"defaultPage": "welcome",
2+
"defaultPage": "home",
3+
"customCSS": "custom/theme.css",
34
"metadata": {
4-
"description": "Documentation for Litruv's plugins",
5-
"thumbnail": "img/og-image.png",
6-
"site_name": "Litruv"
5+
"title": "Project Documentation",
6+
"description": "Comprehensive documentation for various projects.",
7+
"thumbnail": "img/default-thumbnail.png",
8+
"site_name": "DocsHub"
79
},
810
"documents": [
911
{
10-
"title": "Welcome",
12+
"title": "Home",
1113
"path": "docs/index.md",
12-
"slug": "welcome"
14+
"slug": "home"
1315
},
1416
{
15-
"title": "Unreal Engine",
17+
"title": "Category One",
1618
"type": "folder",
19+
"path": "docs/category-one.md",
1720
"color": "#2196f3",
18-
"path": "docs/unreal-engine.md",
19-
"slug": "unreal-engine",
2021
"items": [
2122
{
22-
"title": "DeepImpact",
23-
"path": "docs/DeepImpact.md",
24-
"slug": "deep-impact"
23+
"title": "Feature A",
24+
"path": "docs/feature-a.md",
25+
"slug": "feature-a"
2526
},
2627
{
27-
"title": "WIP: Objective Marker System",
28-
"path": "docs/objective-marker-system.md",
29-
"slug": "objective-markers",
28+
"title": "Feature B",
29+
"path": "docs/feature-b.md",
30+
"slug": "feature-b",
3031
"thumbnail": "images/docThumb.png"
3132
}
3233
]
3334
}
3435
],
3536
"author": {
36-
"name": "Litruv",
37-
"role": "Dev/Tech Artist @MatesMedia",
37+
"name": "John Doe",
38+
"role": "Software Engineer",
3839
"socials": [
3940
{
4041
"icon": "fab fa-github",
41-
"url": "https://github.com/Litruv",
42-
"title": "GitHub - Litruv"
42+
"url": "https://github.com/johndoe",
43+
"title": "GitHub - JohnDoe"
4344
},
4445
{
4546
"icon": "fab fa-youtube",
46-
"url": "https://www.youtube.com/c/Litruv",
47-
"title": "YouTube - Litruv"
47+
"url": "https://youtube.com/c/JohnDoe",
48+
"title": "YouTube - JohnDoe"
4849
},
4950
{
5051
"icon": "fab fa-discord",
51-
"url": "https://discordapp.com/users/220772082055774210",
52-
"title": "Discord - @Litruv"
52+
"url": "https://discordapp.com/users/1234567890",
53+
"title": "Discord - @JohnDoe"
5354
},
5455
{
5556
"icon": "fa-brands fa-bluesky",
56-
"url": "https://bsky.app/profile/lit.mates.dev",
57-
"title": "Bluesky - lit.mates.dev"
57+
"url": "https://bsky.app/profile/john.doe.dev",
58+
"title": "Bluesky - john.doe.dev"
5859
}
5960
]
6061
}

0 commit comments

Comments
 (0)