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
This is a re-working of `jupyter-book toc` (by @choldgraf) but with improvements such as:
- configurable index name and suffixes
- using "natural sort order" for files/folders
- using `fnmatch` for matching files/folders to skip
- better testing
Copy file name to clipboardExpand all lines: README.md
+74-15Lines changed: 74 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -205,6 +205,75 @@ meta:
205
205
- doc3
206
206
```
207
207
208
+
To build a ToC file from an existing site:
209
+
210
+
```console
211
+
$ sphinx-etoc create-toc path/to/folder
212
+
```
213
+
214
+
Some rules used:
215
+
216
+
- Files/folders will be skipped if they match a pattern added by `-s` (based on [fnmatch](https://docs.python.org/3/library/fnmatch.html) Unix shell-style wildcards)
217
+
- Sub-folders with no content files inside will be skipped
218
+
- File and folder names will be sorted by [natural order](https://en.wikipedia.org/wiki/Natural_sort_order)
219
+
- If there is a file called `index` (or the name set by `-i`) in any folder, it will be treated as the index file, otherwise the first file by ordering will be used.
220
+
221
+
The command can also guess a `title` for each file, based on its path:
222
+
223
+
- The folder name is used for index files, otherwise the file name
The ToC file is parsed to a `SiteMap`, which is a `MutableMapping` subclass, with keys representing docnames mapping to a `DocItem` that stores information on the toctrees it should contain:
0 commit comments