Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new examples for tags #17

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def transform(project: Project, root: Project):

# Inherit settings for site URL and edit URI
project.config.site_url = posixpath.join(config.site_url, name, "")
project.config.edit_uri = f"edit/master/examples/{name}/docs/"
# @todo: fix relative path - messed up by repo_url
project.config.edit_uri = f"../../../../edit/master/examples/{name}/docs/"

# Inherit settings for theme
if "features" in project.config.theme:
Expand Down
33 changes: 33 additions & 0 deletions examples/tags-hierarchy/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Using tags with hierarchies

This example shows how to use [tags] with scoped listings to create listings
that show pages under the current section. It includes the following pages:

- [Tags] – Listing pages for tag <span class="md-tag">Section</span>

- [Section 1] – Listing pages in scope of section 1

- [Page 1.1] – Page with tags <span class="md-tag">Code</span> and
<span class="md-tag">Code/HTML</span>, and
<span class="md-tag">Code/JavaScript</span>

- [Page 1.2] – Page with tags <span class="md-tag">Code/JavaScript</span>
and <span class="md-tag">Code/CSS</span>

- [Section 2] – Listing pages in scope of section 2

- [Page 2.1] – Page with tags <span class="md-tag">Code</span> and
<span class="md-tag">Code/HTML</span>, and
<span class="md-tag">Code/JavaScript</span>

- [Page 2.2] – Page with tags <span class="md-tag">Code/JavaScript</span>
and <span class="md-tag">Code/CSS</span>

[tags]: https://squidfunk.github.io/mkdocs-material/setup/setting-up-tags/
[Tags]: demo/tags.md
[Section 1]: demo/section-1/index.md
[Page 1.1]: demo/section-1/page-1.md
[Page 1.2]: demo/section-1/page-2.md
[Section 2]: demo/section-2/index.md
[Page 2.1]: demo/section-2/page-1.md
[Page 2.2]: demo/section-2/page-2.md
10 changes: 10 additions & 0 deletions examples/tags-hierarchy/docs/demo/section-1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
tags:
- Section
---

# Section 1

## Tags

<!-- material/tags { scope: true } -->
10 changes: 10 additions & 0 deletions examples/tags-hierarchy/docs/demo/section-1/page-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
tags:
- Code
- Code/HTML
- Code/JavaScript
---

# Page 1.1

...
9 changes: 9 additions & 0 deletions examples/tags-hierarchy/docs/demo/section-1/page-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
tags:
- Code/JavaScript
- Code/CSS
---

# Page 1.2

...
10 changes: 10 additions & 0 deletions examples/tags-hierarchy/docs/demo/section-2/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
tags:
- Section
---

# Section 2

## Tags

<!-- @tags { scope: true } -->
10 changes: 10 additions & 0 deletions examples/tags-hierarchy/docs/demo/section-2/page-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
tags:
- Code
- Code/HTML
- Code/JavaScript
---

# Page 2.1

...
9 changes: 9 additions & 0 deletions examples/tags-hierarchy/docs/demo/section-2/page-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
tags:
- Code/JavaScript
- Code/CSS
---

# Page 2.2

...
3 changes: 3 additions & 0 deletions examples/tags-hierarchy/docs/demo/tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Tags

<!-- material/tags { include: [Section] } -->
48 changes: 48 additions & 0 deletions examples/tags-hierarchy/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright (c) 2016-2023 Martin Donath <[email protected]>

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

# -----------------------------------------------------------------------------
# Recommended: set up configuration validation, see https://t.ly/xpZXU
# -----------------------------------------------------------------------------

# Project information
site_name: Using tags with hierarchies

# Theme
theme:
name: material
features:
- navigation.expand
- navigation.indexes
- navigation.sections

# Plugins
plugins:
- search
- tags:
tags_hierarchy: true

# Markdown extensions
markdown_extensions:
- attr_list
- toc:
permalink: true
- pymdownx.highlight
- pymdownx.superfences
21 changes: 21 additions & 0 deletions examples/tags-hierarchy/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2016-2023 Martin Donath <[email protected]>

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

mkdocs-material
31 changes: 31 additions & 0 deletions examples/tags-scope/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Using tags with scoped listings

This example shows how to use [tags] with scoped listings to create listings
that show pages under the current section. It includes the following pages:

- [Tags] – Listing pages for tag <span class="md-tag">Section</span>

- [Section 1] – Listing pages in scope of section 1

- [Page 1.1] – Page with tags <span class="md-tag">HTML</span> and
<span class="md-tag">JavaScript</span>

- [Page 1.2] – Page with tags <span class="md-tag">JavaScript</span> and
<span class="md-tag">CSS</span>

- [Section 2] – Listing pages in scope of section 2

- [Page 2.1] – Page with tags <span class="md-tag">HTML</span> and
<span class="md-tag">JavaScript</span>

- [Page 2.2] – Page with tags <span class="md-tag">JavaScript</span> and
<span class="md-tag">CSS</span>

[tags]: https://squidfunk.github.io/mkdocs-material/setup/setting-up-tags/
[Tags]: demo/tags.md
[Section 1]: demo/section-1/index.md
[Page 1.1]: demo/section-1/page-1.md
[Page 1.2]: demo/section-1/page-2.md
[Section 2]: demo/section-2/index.md
[Page 2.1]: demo/section-2/page-1.md
[Page 2.2]: demo/section-2/page-2.md
10 changes: 10 additions & 0 deletions examples/tags-scope/docs/demo/section-1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
tags:
- Section
---

# Section 1

## Tags

<!-- @tags { scope: true } -->
9 changes: 9 additions & 0 deletions examples/tags-scope/docs/demo/section-1/page-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
tags:
- HTML
- JavaScript
---

# Page 1.1

...
9 changes: 9 additions & 0 deletions examples/tags-scope/docs/demo/section-1/page-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
tags:
- JavaScript
- CSS
---

# Page 1.2

...
10 changes: 10 additions & 0 deletions examples/tags-scope/docs/demo/section-2/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
tags:
- Section
---

# Section 2

## Tags

<!-- @tags { scope: true } -->
9 changes: 9 additions & 0 deletions examples/tags-scope/docs/demo/section-2/page-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
tags:
- HTML
- JavaScript
---

# Page 2.1

...
9 changes: 9 additions & 0 deletions examples/tags-scope/docs/demo/section-2/page-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
tags:
- JavaScript
- CSS
---

# Page 2.2

...
3 changes: 3 additions & 0 deletions examples/tags-scope/docs/demo/tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Tags

<!-- @tags { include: [Section] } -->
47 changes: 47 additions & 0 deletions examples/tags-scope/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright (c) 2016-2023 Martin Donath <[email protected]>

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

# -----------------------------------------------------------------------------
# Recommended: set up configuration validation, see https://t.ly/xpZXU
# -----------------------------------------------------------------------------

# Project information
site_name: Using tags with scoped listings

# Theme
theme:
name: material
features:
- navigation.expand
- navigation.indexes
- navigation.sections

# Plugins
plugins:
- search
- tags

# Markdown extensions
markdown_extensions:
- attr_list
- toc:
permalink: true
- pymdownx.highlight
- pymdownx.superfences
21 changes: 21 additions & 0 deletions examples/tags-scope/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2016-2023 Martin Donath <[email protected]>

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

mkdocs-material
31 changes: 31 additions & 0 deletions examples/tags-shadow/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Using shadow tags

This example shows how to use shadow [tags] and includes the following pages:

- [Tags] – Listing pages for tag <span class="md-tag md-tag-shadow">Draft</span>
and <span class="md-tag">Section</span>

- [Section 1] – Listing pages in scope of section 1

- [Page 1.1] – Page with tags <span class="md-tag">HTML</span> and
<span class="md-tag">JavaScript</span>

- [Page 1.2] – Page with tags <span class="md-tag">JavaScript</span> and
<span class="md-tag">CSS</span>

- [Section 2] – Listing pages in scope of section 2

- [Page 2.1] – Page with tags <span class="md-tag">HTML</span> and
<span class="md-tag">JavaScript</span>

- [Page 2.2] – Page with tags <span class="md-tag">JavaScript</span> and
<span class="md-tag">CSS</span>

[tags]: https://squidfunk.github.io/mkdocs-material/setup/setting-up-tags/
[Tags]: demo/tags.md
[Section 1]: demo/section-1/index.md
[Page 1.1]: demo/section-1/page-1.md
[Page 1.2]: demo/section-1/page-2.md
[Section 2]: demo/section-2/index.md
[Page 2.1]: demo/section-2/page-1.md
[Page 2.2]: demo/section-2/page-2.md
10 changes: 10 additions & 0 deletions examples/tags-shadow/docs/demo/section-1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
tags:
- Section
---

# Section 1

## Tags

<!-- @tags { scope: true, exclude: [Draft] } -->
Loading