You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/installation.md
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ tags:
6
6
7
7
# Installation
8
8
9
-
Installation of Foliant is split into three stages: installing Python with your system’s package manager, installing Foliant with pip, and optionally installing Pandoc and TeXLive bundle. Below you’ll find the instructions for three popular platforms: macOS, Windows, and Ubuntu.
9
+
Installation of Foliant is split into three stages: installing Python with your system’s package manager, installing Foliant with pip or Poetry, and optionally installing Pandoc and TeXLive bundle. Below you’ll find the instructions for three popular platforms: macOS, Windows, and Ubuntu.
10
10
11
11
Alternatively, you can avoid installing Foliant and its dependencies on your system by using <linktitle="Docker">Docker and Docker Compose</link>.
12
12
@@ -80,6 +80,25 @@ Alternatively, you can avoid installing Foliant and its dependencies on your sys
80
80
$ pip3 install foliantcontrib.pandoc
81
81
82
82
83
+
## Poetry
84
+
85
+
If you prefer to manage Foliant and its extensions as dependencies of your documentation project, you can use [Poetry](https://python-poetry.org/).
86
+
87
+
1. Install [Python](https://www.python.org/) and [Poetry](https://python-poetry.org/docs/#installation) globally on your system.
88
+
89
+
2. Initialize a new Poetry project in your documentation directory:
90
+
91
+
$ poetry init
92
+
93
+
3. Add Foliant and the necessary extensions as dependencies:
94
+
95
+
$ poetry add foliant foliantcontrib.init
96
+
97
+
4. To build your project, use `poetry run`:
98
+
99
+
$ poetry run foliant make site
100
+
101
+
83
102
## Docker
84
103
85
104
There is a selection of Docker images for Foliant in the [Docker hub](https://hub.docker.com/r/foliant/foliant):
Copy file name to clipboardExpand all lines: src/tutorials/first_project.md
+47-5Lines changed: 47 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ tags:
7
7
8
8
In this tutorial, you’ll learn how to use Foliant to build websites and pdf documents from a single Markdown source. You’ll also learn how to use Foliant preprocessors.
9
9
10
-
> It is recommended to <linksrc="docker.md">run Foliant through Docker</link> to get consistent results on different machines, but it's also perfectly fine to run it natively (e.g. as a pure CLI tool without virtualization). In this tutorial, we will show the example commands for both native way (these will go first) and the Docker way (these will follow).
10
+
> It is recommended to <linksrc="docker.md">run Foliant through Docker</link> to get consistent results on different machines, but it's also perfectly fine to run it natively (e.g. as a pure CLI tool without virtualization) or using **Poetry** for dependency management. In this tutorial, we will show the example commands for the native way, the Poetry way, and the Docker way.
11
11
12
12
13
13
## Create New Project
@@ -20,11 +20,18 @@ To use it, run `foliant init` command
20
20
21
21
```bash
22
22
$ foliant init
23
+
```
24
+
25
+
Or, with Poetry
26
+
27
+
```bash
28
+
$ poetry run foliant init
29
+
```
30
+
23
31
Enter the project name: Hello Foliant
24
32
Generating Foliant project
25
33
─────────────────────
26
34
Project "Hello Foliant" created in hello-foliant
27
-
```
28
35
29
36
To do the same with Docker, run
30
37
@@ -72,19 +79,32 @@ Let’s start with **MkDocs** backend. First, install it using the following com
72
79
pip3 install foliantcontrib.mkdocs
73
80
```
74
81
82
+
Or with Poetry
83
+
84
+
```bash
85
+
poetry add foliantcontrib.mkdocs
86
+
```
87
+
75
88
Docker users would normally need to add this package to the `requirements.txt` file instead, but mkdocs is already there by default if you used `init` to generate project structure.
76
89
77
90
To build a site, in the project directory, run
78
91
79
92
```bash
80
93
$ foliant make site
94
+
```
95
+
96
+
Or with Poetry
97
+
98
+
```bash
99
+
$ poetry run foliant make site
100
+
```
101
+
81
102
Parsing config... Done
82
103
Applying preprocessor mkdocs... Done
83
104
Applying preprocessor _unescape... Done
84
105
Making site with MkDocs... Done
85
106
────────────────────
86
107
Result: Hello_Foliant-2020-05-25.mkdocs
87
-
```
88
108
89
109
Or, with Docker Compose
90
110
@@ -118,13 +138,22 @@ Then, in the project directory, run
118
138
119
139
```bash
120
140
$ foliant make pdf
141
+
```
142
+
143
+
Or with Poetry
144
+
145
+
```bash
146
+
$ poetry run foliant make pdf
147
+
```
148
+
121
149
Parsing config... Done
122
150
Applying preprocessor flatten... Done
123
151
Applying preprocessor _unescape... Done
124
152
Making pdf with Pandoc... Done
125
153
────────────────────
126
154
Result: Hello_Foliant-2020-05-25.pdf
127
-
```
155
+
156
+
To build pdf in Docker container
128
157
129
158
To build pdf in Docker container, first uncomment `foliant/foliant:pandoc` in your project’s `Dockerfile`
130
159
@@ -199,6 +228,14 @@ The native command
199
228
200
229
```bash
201
230
foliant make pdf && foliant make site
231
+
```
232
+
233
+
Or with Poetry
234
+
235
+
```bash
236
+
poetry run foliant make pdf && poetry run foliant make site
@@ -263,6 +299,12 @@ First, we need to install the blockdiag preprocessor
263
299
$ pip3 install foliantcontrib.blockdiag
264
300
```
265
301
302
+
Or with Poetry
303
+
304
+
```bash
305
+
$ poetry add foliantcontrib.blockdiag
306
+
```
307
+
266
308
Or, if you are building with docker, add `foliantcontrib.blockdiag` to requirements.txt and rebuild the image with `docker-compose build` command.
267
309
268
310
Next, we need to switch on the <linksrc="!path src/preprocessors/blockdiag.md"title="Blockdiag">`blockdiag`</link> preprocessor in project config. Open `foliant.yml` and add the following lines
0 commit comments