Skip to content

Commit

Permalink
Add example including file only if exists (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja authored Nov 28, 2024
1 parent f725896 commit 6922478
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
Empty file.
1 change: 1 addition & 0 deletions examples/include-if-exists/docs/included.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Some included content.
5 changes: 5 additions & 0 deletions examples/include-if-exists/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- Only include 'included.md' if exists. Always include 'empty.md'. -->

{% include-markdown '?(empty.md)?(included.md)' %}

{% include-markdown '?(empty.md)?(not-existent.md)' %}
3 changes: 3 additions & 0 deletions examples/include-if-exists/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
site_name: Foo
plugins:
- include-markdown

0 comments on commit 6922478

Please sign in to comment.