Skip to content

Commit

Permalink
Add file system loader to jinja contex
Browse files Browse the repository at this point in the history
Ability to use `include` and/or `import` jinja clauses in the markdown
  • Loading branch information
risik authored Sep 27, 2023
1 parent 24492bc commit 7d4421b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion markdownextradata/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ def on_page_markdown(self, markdown, page, **kwargs):
# Initialize this mkdocs config and Jinja2 env
def on_config(self, mkdocsConfig, **kwargs):
jinja_options = self.config[self.JINJA_OPTIONS]
self.env = jinja2.Environment(undefined=jinja2.DebugUndefined, **jinja_options)
self.env = jinja2.Environment(
undefined=jinja2.DebugUndefined,
loader=jinja2.FileSystemLoader(mkdocsConfig["docs_dir"]),
**jinja_options
)
self.mkdocsConfig = mkdocsConfig

# Apply Jinja2 substitution to specified string
Expand Down

0 comments on commit 7d4421b

Please sign in to comment.