4

Is there a way to dynamically generate a list of files under the current page's folder structure in mkdocs? I'm looking for something kind of like the Confluence "children display" macro, so that if my folder structure is

Page1/index.md
Page1/subfolder/sub1.md
Page1/subfolder/sub2.md
Page2/index.md

then I want some way to list subfolder and its contents within the body of Page1/index.md.

wrschneider
  • 17,913
  • 16
  • 96
  • 176

1 Answers1

0

I am the author of mkdocs-macros, which basically adds templating capabilities to your markdown pages. If you are willing to add jinja2 code to your markdown pages, you could use that plugin. The object you are looking for is {{ navigation }}.

To see what is in there, just use, in any of your pages:

# My page's title

{{ context(navigation) | pretty }}

This is not the full answer, but should get you started :-)

fralau
  • 3,279
  • 3
  • 28
  • 41