foliant-docs / foliant

Comprehensive markdown-based documentation toolkit
https://foliant-docs.github.io/docs/
MIT License
160 stars 9 forks source link

Glob syntax for "chapters" in foliant.yml config #66

Open v4dkou opened 1 year ago

v4dkou commented 1 year ago

We have two cases, where it would be desirable to forgo explicit enumeration of chapters:

  1. When we already use numbers/alphabetic order on the file system level
  2. When we don't care about the order of chapters at all

If pyyaml supports multiple tags, this syntax would be desirable

chapters: !glob !path chapters/**/*.md
// or when we care about order of chapters _surrounding_ some block of chapters
chapters: 
   - index.md
   - !glob !path chapters/**/*.md
   - last_chapter.md

If pyyaml does not support multiple tags, something like !glob_path would be nice, or even just accept glob syntax by default.

Temporary solutions

Currently we use this snippet to automatically add chapters to config

find src -type f -name "*.md" | sort --numeric-sort | sed "s/src\// - /" >> foliant.yml

Alternatively, one could use a snippet to form a different file completely automated, but

find src -type f -name "*.md" | sort --numeric-sort | sed "s/src\// - /" > chapters.yml