Skip to content

Commit 3b22df9

Browse files
committed
Clarify extension-driven docs workflow
1 parent f0af407 commit 3b22df9

28 files changed

Lines changed: 1656 additions & 289 deletions

configurations/config.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@ webifier:
44
uses: webifier.standard
55
markdown:
66
uses: webifier.markdown
7+
toc: true
8+
cleanup: false
79
notebook:
810
uses: webifier.notebook
11+
toc: true
12+
cleanup: true
13+
colab: true
914
pdf:
1015
uses: webifier.pdf
16+
toc: false
17+
download: true
18+
toolbar: true
19+
height: min(82vh, 1100px)
1120
theme:
1221
uses: webifier.theme
1322
switcher: true
@@ -47,6 +56,8 @@ page_navigation:
4756
items:
4857
- title: User Guide
4958
href: /pages/user-guide/
59+
- title: Hello World Website
60+
href: /pages/user-guide/tutorials/00-hello-world.html
5061
- title: Installation and GitHub Actions
5162
href: /pages/user-guide/tutorials/00-installation-and-github-actions.html
5263
- title: YAML Pages and Sections
@@ -101,7 +112,7 @@ page_navigation:
101112
href: /pages/user-guide/08-template-renderers.html
102113
- title: Python Renderers and Resolvers
103114
href: /pages/user-guide/09-python-renderers-and-resolvers.html
104-
- title: Reusable Website Formats
115+
- title: Custom Extensions and Reusable Formats
105116
href: /pages/user-guide/10-reusable-formats.html
106117
- title: Reference
107118
items:

pages/user-guide/01-default-site.md

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,20 @@ header:
77

88
# Using the Default Site
99

10-
The fastest way to use Webifier is to let the default renderer do the work. You
11-
create an `index.yml`, point it at content, and let Webifier build the page,
12-
copy assets, and generate linked content pages.
10+
The fastest way to use Webifier is to enable the bundled extensions and let the
11+
default renderers do the work. You create an `index.yml`, point it at content,
12+
and let Webifier build the page, copy assets, and generate linked content pages.
13+
14+
Webifier core does not try to own a giant website syntax. The syntax becomes
15+
useful when extensions are enabled. In the default setup:
16+
17+
| Extension | What it teaches Webifier |
18+
|---|---|
19+
| `webifier.standard` | Page controls such as `header`, `nav`, `meta`, `footer`, sections, links, and the base page shell |
20+
| `webifier.markdown` | Markdown blocks and linked Markdown pages |
21+
| `webifier.notebook` | Linked notebook pages and notebook page config |
22+
| `webifier.pdf` | Linked PDF pages with site navigation and optional controls |
23+
| `webifier.theme` | Light/dark/system theme behavior |
1324

1425
For the first-principles version of this idea, start with
1526
[YAML Pages and Sections](index=pages/user-guide/tutorials/01-yaml-pages-and-sections.yml).
@@ -28,6 +39,8 @@ config:
2839
uses: webifier.markdown
2940
notebook:
3041
uses: webifier.notebook
42+
pdf:
43+
uses: webifier.pdf
3144

3245
header:
3346
title: My Project
@@ -45,21 +58,55 @@ docs:
4558
body: |
4659
- [Project Notes](md=pages/notes.md)
4760
- [Experiment Notebook](md=pages/experiment.ipynb)
61+
- [Final Report](pdf=reports/final.pdf)
4862
```
4963
50-
The root YAML file becomes the home page. Each top-level key after `title`,
51-
`header`, `nav`, `meta`, and `config` becomes a section rendered by the default
52-
section renderer.
64+
The root YAML file becomes the home page. With `webifier.standard` enabled,
65+
page-level keys such as `title`, `header`, `nav`, `footer`, `meta`, `style`, and
66+
`config` are controls. Other top-level keys become sections rendered in source
67+
order.
68+
69+
That distinction is extension-defined. A custom extension can claim another
70+
page key, consume it, and remove it before section rendering. If no extension
71+
claims a key, the standard renderer treats it as content.
5372

5473
## What You Get By Default
5574

5675
- A homepage assembled from YAML sections
5776
- Markdown rendering for text blocks
5877
- Generated pages for linked Markdown and notebook files
78+
- Embedded PDF pages when the PDF extension is enabled
5979
- Asset copying for local images and files
6080
- Search index generation
6181
- Navigation, comments, analytics, and theme support when configured
6282

83+
## The Default Contract
84+
85+
Use this split when you are deciding where something belongs:
86+
87+
| Put it here | When |
88+
|---|---|
89+
| `config.webifier.extensions` | You are enabling or configuring site behavior |
90+
| `config.<instance-name>` | You are overriding one extension for one page |
91+
| reserved page keys | You are changing page chrome, such as title, header, nav, or footer |
92+
| ordinary page keys | You are adding visible sections |
93+
| linked content files | You already have Markdown, notebooks, PDFs, HTML, or assets in the repo |
94+
95+
For example:
96+
97+
```yaml
98+
config:
99+
markdown:
100+
toc: false
101+
102+
summary:
103+
label: Summary
104+
content: This is visible.
105+
```
106+
107+
`config.markdown` changes Markdown behavior for this page. `summary` renders as
108+
content.
109+
63110
## When To Stay With Defaults
64111

65112
Stay with the default renderer when the goal is to publish clearly, not design a

pages/user-guide/02-render-and-automate.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ Install Webifier in the Python environment you use for the project:
1919
pip install webifier
2020
```
2121

22+
Installing `webifier` also installs the first-party extension package. If your
23+
site uses third-party or project-specific extensions, install those into the
24+
same environment:
25+
26+
```shell
27+
pip install webifier my-webifier-extension
28+
```
29+
2230
From the repository root, run:
2331

2432
```shell
@@ -41,6 +49,28 @@ python -m http.server 4173 --directory webified
4149

4250
Then open `http://localhost:4173/`.
4351

52+
## Extension Dependencies
53+
54+
Webifier is extension-dependent by design. Your root page config declares which
55+
extension instances are active:
56+
57+
```yaml
58+
config:
59+
webifier:
60+
extensions:
61+
site:
62+
uses: webifier.standard
63+
markdown:
64+
uses: webifier.markdown
65+
related_posts:
66+
uses: my.related_posts
67+
source: posts/
68+
```
69+
70+
That config is enough only if the Python package providing `my.related_posts`
71+
is installed. Local builds, GitHub Actions, and any other build environment
72+
need the same packages available before `webify` runs.
73+
4474
## Automate With GitHub Actions
4575

4676
Add a workflow such as `.github/workflows/webifier.yml`:
@@ -64,12 +94,14 @@ jobs:
6494
uses: actions/checkout@v4
6595
6696
- name: Webify
67-
uses: webifier/build@v1.0.1
97+
uses: webifier/build@v1.0.5
6898
with:
6999
baseurl: ''
70100
index: index.yml
71101
publish_dir: webified
72102
templates_dir: .
103+
# Optional: install custom extension packages before rendering.
104+
# extra-packages: my-webifier-extension
73105
74106
- name: Deploy to GitHub Pages
75107
uses: peaceiris/actions-gh-pages@v3
@@ -82,6 +114,28 @@ If your site is published under a project path such as
82114
`https://username.github.io/project-name/`, set `--baseurl '/project-name'`
83115
instead of `''`.
84116

117+
For a custom extension package from GitHub:
118+
119+
```yaml
120+
extra-packages: "my-webifier-extension @ git+https://github.com/me/my-webifier-extension.git"
121+
```
122+
123+
For more than one package, use a YAML block with one requirement per line:
124+
125+
```yaml
126+
extra-packages: |
127+
my-webifier-extension
128+
another-extension
129+
```
130+
131+
If you call `webify` directly instead of using the action, add the extension to
132+
the install step:
133+
134+
```yaml
135+
- name: Install Webifier and extensions
136+
run: pip install webifier my-webifier-extension
137+
```
138+
85139
## What Automation Gives You
86140

87141
Git tracks the source content. GitHub Actions notices a push. Webifier renders
@@ -95,4 +149,14 @@ project:
95149
3. Push to GitHub.
96150
4. Let the action rebuild the website.
97151

152+
## Summary
153+
154+
| Where | What to remember |
155+
|---|---|
156+
| `pip install webifier` | Installs core Webifier and first-party extensions. |
157+
| custom extensions | Install them wherever `webify` runs. |
158+
| `config.webifier.extensions` | Declares the extension instances the site uses. |
159+
| Webifier action | Use `extra-packages` for third-party or project-specific extensions. |
160+
| direct CLI workflow | Install custom packages before calling `webify`. |
161+
98162
Next: [Navigation and Pages](03-navigation-and-pages.html).

pages/user-guide/03-navigation-and-pages.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,70 @@ content:
3939
The brand link usually takes people home, so you do not need a separate Home
4040
item unless your site wants one.
4141
42+
## Bottom Page Navigation
43+
44+
The standard page templates can also render a bottom previous/home/next block.
45+
This is useful for documentation, tutorials, course notes, and any content that
46+
has a preferred reading order.
47+
48+
Set the default sequence in site config:
49+
50+
```yaml
51+
config:
52+
page_navigation:
53+
home:
54+
title: User Guide
55+
href: /pages/user-guide/
56+
items:
57+
- title: Start
58+
href: /pages/user-guide/
59+
- title: Installation
60+
src: pages/user-guide/tutorials/00-installation-and-github-actions.yml
61+
- title: YAML Pages
62+
src: pages/user-guide/tutorials/01-yaml-pages-and-sections.yml
63+
- title: Section Controls
64+
src: pages/user-guide/tutorials/02-section-controls.yml
65+
```
66+
67+
`items` can be nested for organization. Webifier flattens the readable entries,
68+
matches the current page by `href` or `src`, then renders the previous and next
69+
neighbors. `src` entries are resolved to the generated `.html` URL, which keeps
70+
the config close to the source files.
71+
72+
Each page can override or hide this block from its own `config`:
73+
74+
```markdown
75+
---
76+
title: One-off Page
77+
config:
78+
page_navigation: false
79+
---
80+
```
81+
82+
Or override individual slots:
83+
84+
```yaml
85+
config:
86+
page_navigation:
87+
previous: false
88+
home:
89+
title: Docs
90+
href: /pages/user-guide/
91+
next:
92+
title: Extension Overview
93+
href: /pages/user-guide/extensions/
94+
```
95+
96+
Slot values can be:
97+
98+
- `false`: hide that slot.
99+
- a string: use it as the link URL.
100+
- an object with `title` or `text` plus `href`, `link`, or `src`.
101+
102+
Page-local navigation config is merged over the site-level sequence for that
103+
page only. Linked child pages use the site default unless they define their own
104+
page config.
105+
42106
## Generated Content Pages
43107

44108
Use `md=...` links when you want Webifier to render a source file as a page:

pages/user-guide/04-content-files.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Link to a Markdown file with `md=...` to generate a page:
2020
[Read the notes](md=pages/notes.md)
2121
```
2222

23-
Markdown front matter can provide page metadata:
23+
Markdown page prefaces can provide the same page data as YAML pages:
2424

2525
```markdown
2626
---
@@ -33,7 +33,7 @@ header:
3333
# Notes
3434
```
3535

36-
Front matter can set page controls such as `title`, `header`, `nav`, `footer`,
36+
The page preface can set page controls such as `title`, `header`, `nav`, `footer`,
3737
`meta`, `style`, and page-local `config`.
3838

3939
## Notebooks
@@ -48,7 +48,7 @@ This makes Webifier a good fit for research projects, experiments, and small
4848
technical reports where the notebook is the work and the website is the sharing
4949
surface.
5050

51-
Notebook pages can use the same page metadata shape in the first Markdown cell:
51+
Notebook pages can use the same page-data shape in the first Markdown cell:
5252

5353
```markdown
5454
---
@@ -75,11 +75,11 @@ site-styled frame:
7575
[Read the report](pdf=reports/index.pdf)
7676
```
7777

78-
Put `metadata.yml` beside the PDF to control the generated page title:
78+
Put `page.yml` beside the PDF to control the generated page title:
7979

8080
```yaml
8181
title: Final Report
82-
metadata:
82+
meta:
8383
description: Embedded PDF report.
8484
```
8585

0 commit comments

Comments
 (0)