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: README.md
+52-21
Original file line number
Diff line number
Diff line change
@@ -96,14 +96,44 @@ rc-release-notes
96
96
kc-rt-faq Ripple Trade Migration FAQ
97
97
```
98
98
99
-
#### Githubify Mode
99
+
#### Building Markdown
100
100
101
-
This mode runs the preprocessor only, so you can generate Markdown files that are more likely to display properly in conventional Markdown parsers (like the one built into GitHub). Use the `-g` flag followed by a doc page (relative to the configured content dir):
101
+
This mode runs the pre-processor only, so you can generate Markdown files that are more likely to display properly in conventional Markdown parsers (like the one built into GitHub). Use the `--md` flag to output Markdown files, skipping the HTML/PDF templates entirely.
102
102
103
103
```sh
104
-
$ dactyl_build -g page_with_dactyl_syntax.md
104
+
$ dactyl_build --md
105
105
```
106
106
107
+
In Markdown mode, the `-s` option does not copy static files from the `template_static_path`.
108
+
109
+
#### Building Only One Page
110
+
111
+
If you only want to build a single page, you can use the `--only` flag, followed by the filename you want to build (either the input filename ending in `.md` or the output filename ending in `.html`):
112
+
113
+
```sh
114
+
dactyl_build --only index.html --pdf
115
+
```
116
+
117
+
This command can be combined with the `--pdf` or `--md` flags. You can also use it with the `--target` setting (in case you want the context from the target even though you're only building one page.)
118
+
119
+
#### Watch Mode
120
+
121
+
You can use the `-w` flag to make Dactyl run continuously, watching for changes to its input templates or markdown files. Whenever it detects that a file has changed, Dactyl automatically rebuilds the output in whatever the current mode is, (HTML, PDF, or Markdown).
122
+
123
+
To be detected as a change, the file has to match one of the following patterns:
124
+
125
+
```
126
+
*.md
127
+
*/code_samples/*
128
+
template-*.html
129
+
```
130
+
131
+
Beware: some configurations can lead to an infinite loop. (For example, if your output directory is a subdirectory of your content directory and you use Dactyl in `--md` mode.)
132
+
133
+
**Limitations:** Watch mode can be combined with `--only`, but re-builds the page even when it detects changes to unrelated pages. Watch mode doesn't detect changes to the config file, static files, or filters.
134
+
135
+
To stop watching, interrupt the Dactyl process (Ctrl-C in most terminals).
136
+
107
137
### Link Checking
108
138
109
139
The link checker is a separate script. It assumes that you've already built some documentation to an output path. Use it as follows:
@@ -182,14 +212,11 @@ targets:
182
212
display_name: Ripple Trade Migration FAQ
183
213
```
184
214
185
-
In addition to `name` and `display_name`, a target definition can contain the following fields:
215
+
In addition to `name` and `display_name`, a target definition can contain arbitrary key-values to be inherited by all pages in this target. Dictionary values are inherited such that keys that aren't set in the page are carried over from the target, recursively. The rest of the time, fields that appear in a page definition take precedence over fields that appear in a target definition.
216
+
217
+
Some things you may want to set at the target level include `filters` (an array of filters to apply to pages in this target), `template` (template to use when building HTML), and `pdf_template` (template to use when building PDF). You can also use the custom values in templates and preprocessing. Some filters define additional fields that affect the filter's behavior.
|`filters`| Array | Names of filters to apply to all pages in this target. |
190
-
|`image_subs`| Dictionary | Mapping of image paths to replacement paths that should be used when building this target. (Use this, for example, to provide absolute paths to images uploaded to a CDN or CMS.) |
191
-
|`image_re_subs`| Dictionary | Same as `image_subs`, but the keys are regular expressions and the patterns can contain backreferences to matched subgroups (e.g. `\\1` for the first parenthetical group). |
192
-
| ... | (Various) | Arbitrary key-values to be inherited by all pages in this target. (You can use this for pre-processing or in templates.) The following field names cannot be used: `name`, `display_name`, `image_subs`, `filters`, and `pages`. |
219
+
The following field names cannot be inherited: `name`, `display_name`, and `pages`.
@@ -232,7 +257,6 @@ Each individual page definition can have the following fields:
232
257
|`category`| String |_(Optional)_ The name of a category to group this page into. This is used by Dactyl's built-in templates to organize the table of contents. |
233
258
|`template`| String |_(Optional)_ The filename of a custom [Jinja][] HTML template to use when building this page for HTML, relative to the **template_path** in your config. |
234
259
|`pdf_template`| String |_(Optional)_ The filename of a custom [Jinja][] HTML template to use when building this page for PDF, relative to the **template_path** in your config. |
235
-
| (Short names of targets) | String |_(Optional)_ If provided, use these values to replace links that would go to this file when building the specified targets. Use this if the page can't be accessed via its normal .html filename in some situations. |
236
260
| ... | (Various) | Additional arbitrary key-value pairs as desired. These values can be used by templates or pre-processing. |
237
261
238
262
[Jinja]: http://jinja.pocoo.org/
@@ -248,8 +272,13 @@ Dactyl pre-processes Markdown files by treating them as [Jinja][] Templates, so
|`target`| The [target](#targets) definition of the current target. |
251
-
|`pages`| The [array of page definitions](#pages) in the current target. |
275
+
|`pages`| The [array of page definitions](#pages) in the current target. Use this to generate navigation across pages. (The default templates don't do this, but you should.) |
252
276
|`currentpage`| The definition of the page currently being rendered. |
277
+
|`categories`| A de-duplicated array of categories that are used by at least one page in this target, sorted in the order they first appear. |
278
+
|`config`| The global Dactyl config object. |
279
+
|`content`| The parsed HTML content of the page currently being rendered. |
280
+
|`current_time`| The current date as of rendering. The format is YYYY-MM-DD by default; you can also set the `time_format` field to a custom [stftime format string](http://strftime.org/). |
281
+
|`mode`| The output format: either `html` (default), `pdf`, or `md`. |
253
282
254
283
255
284
### Adding Variables from the Commandline
@@ -282,15 +311,14 @@ You cannot set the following reserved keys:
282
311
283
312
-`name`
284
313
-`display_name` (Instead, use the `--title` argument to set the display name of the target on the commandline.)
285
-
-`filters`
286
-
-`image_subs`
287
-
-`image_re_subs`
288
314
-`pages`
289
315
290
316
291
317
### Filters
292
318
293
-
Furthermore, Dactyl supports additional custom post-processing through the use of filters. Filters can operate on the markdown (after it's been pre-processed), on the raw HTML (after it's been parsed), or on a BeautifulSoup object representing the output HTML. Dactyl comes with several filters, which you can enable in your config file. Support for user-defined filters is planned but not yet implemented.
319
+
Furthermore, Dactyl supports additional custom post-processing through the use of filters. Filters can operate on the markdown (after it's been pre-processed), on the raw HTML (after it's been parsed), or on a BeautifulSoup object representing the output HTML. Dactyl comes with several filters, which you can enable in your config file.
320
+
321
+
You can also write your own filters. If you do, you must specify the paths to the folder(s) containing your filter files in the `filter_paths` array of the config file.
294
322
295
323
See the [examples](examples/) for examples of how to do many of these things.
296
324
@@ -303,7 +331,10 @@ Dactyl provides the following information to templates, which you can access wit
303
331
|`target`| The [target](#targets) definition of the current target. |
304
332
|`pages`| The [array of page definitions](#pages) in the current target. Use this to generate navigation across pages. (The default templates don't do this, but you should.) |
305
333
|`currentpage`| The definition of the page currently being rendered. |
306
-
|`categories`| An array of categories that are used by at least one page in this target. |
334
+
|`categories`| A de-duplicated array of categories that are used by at least one page in this target, sorted in the order they first appear. |
335
+
|`config`| The global Dactyl config object. |
307
336
|`content`| The parsed HTML content of the page currently being rendered. |
308
-
|`current_time`| The current date as of rendering, in the format "Monthname Day, Year" |
309
-
|`sidebar_content`| A table of contents generated from the current page's headers. Wrap this in a `<ul>` element. |
337
+
|`current_time`| The current date as of rendering. The format is YYYY-MM-DD by default; you can also set the `time_format` field to a custom [stftime format string](http://strftime.org/). |
338
+
|`mode`| The output format: either `html` (default), `pdf`, or `md`. |
339
+
|`page_toc`| A table of contents generated from the current page's headers. Wrap this in a `<ul>` element. |
340
+
|`sidebar_content`| (Deprecated alias for `page_toc`.) |
0 commit comments