-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
86 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ commitlint | |
devel | ||
dists | ||
docstrings | ||
endraw | ||
fontawesome | ||
htmlproofer | ||
inlinehilite | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
hide: | ||
- navigation | ||
- toc | ||
--- | ||
|
||
# Enabling mkdocs-ansible macros | ||
|
||
In order to activate the macros inside your documentation project you need to | ||
add: | ||
|
||
```yaml | ||
# mkdocs.yml | ||
plugins: | ||
- macros: | ||
modules: [mkdocs-ansible:mkdocs_ansible] | ||
``` | ||
# Using install_from_adt macro | ||
Inside markdown documentation include a section like below, the expanded | ||
result can be seen after the example. | ||
```markdown | ||
{% raw %} | ||
{{ install_from_adt("ansible-navigator") }} | ||
{% endraw %} | ||
``` | ||
|
||
{{ install_from_adt("ansible-navigator") }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,40 @@ | ||
"""mkdocs-ansible theme.""" | ||
|
||
from __future__ import annotations | ||
|
||
try: | ||
from ._version import version as __version__ # type: ignore | ||
|
||
except ImportError: # pragma: no cover | ||
__version__ = "0.1.dev1" | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from mkdocs_macros.plugin import MacrosPlugin | ||
|
||
__all__ = ("__version__",) | ||
|
||
|
||
def install_from_adt(name: str) -> str: | ||
"""install_from_adt macro.""" | ||
result = f"""!!! Recommendation | ||
The **recommended** approach to install `{name}` is using the | ||
`ansible-dev-tools` package. | ||
[Ansible Development Tools (ADT)](https://ansible.readthedocs.io/projects/dev-tools/) | ||
aims to streamline the setup and usage of several tools needed in order to | ||
create [Ansible](https://www.ansible.com) content. ADT combines critical Ansible | ||
development packages into a unified Python package. | ||
```bash | ||
# This also installs ansible-core if it is not already installed | ||
pip3 install ansible-dev-tools | ||
``` | ||
""" | ||
return result | ||
|
||
|
||
def define_env(env: MacrosPlugin) -> None: | ||
"""Declare environment for jinja2 templates for markdown.""" | ||
for fn in [install_from_adt]: | ||
env.macro(fn) |