You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Most scripts here requires the <ahref="https://github.com/fralau/mkdocs-macros-plugin">mkdocs-macro-plugin</a> which involves some setting up</p>
780
-
<h2id="install-macros">Install macros</h2>
797
+
<p>Assuming you're inside your mkdocs project directory...</p>
798
+
<h2id="1-install-macros">1. Install macros</h2>
781
799
<p>Install <strong>macros</strong> via <ahref="https://mkdocs-macros-plugin.readthedocs.io/en/latest/#installation">mkdocs-macro-plugin</a> as well as required packages</p>
<p>In your project's root directory (<strong>not</strong> the docs directory), create a <code>main.py</code> file and copy the contents of main.py into it. </p>
807
+
<h2id="2-create-an-mkdocs-hook">2. Create an mkdocs hook</h2>
808
+
<p>Add an mkdocs <ahref="https://www.mkdocs.org/user-guide/configuration/#hooks">hook</a> e.g. <code>hooks.py</code> in your project's root directory (<strong>not</strong> the docs directory) with the following content:</p>
<p>This is important for use in <ahref="../macros-reference/listnavs/">listnavs()</a>, as it allows the macro to receive nav events from mkdocs/other plugins.</p>
<p>In your project's root directory (<strong>not</strong> the docs directory), create a <code>main.py</code> file and copy the contents of <ahref="https://github.com/skedastically/mkdocs-macro-gimmicks/blob/main/main.py">main.py</a> into it. </p>
<pclass="admonition-title">Nested listings are not supported (yet?)</p>
790
790
</div>
791
791
<h2id="usage-with-awesome-nav">Usage with awesome-nav</h2>
792
-
<p><code>listnavs()</code> can be used with <ahref="https://github.com/lukasgeiter/mkdocs-awesome-nav">awesome-nav</a> with some tweaks:</p>
793
-
<ol>
794
-
<li>Add an mkdocs <ahref="https://www.mkdocs.org/user-guide/configuration/#hooks">hook</a> e.g. <code>hooks.py</code> in your project's root directory (<strong>not</strong> the docs directory) with the following content:</li>
<p>Then you can configure both the plugins and this hook in <code>mkdocs.yml</code>. Remember to put macros <strong>after</strong> awesome-nav so the generated navigation can certainly pass through in order.</p>
<p><code>listnavs()</code> can be used with <ahref="https://github.com/lukasgeiter/mkdocs-awesome-nav">awesome-nav</a>, provided that you configured the hook and list the <code>macros</code> plugin <strong>after</strong><code>awesome-nav</code>:</p>
<p>If no <code>config.nav</code> object is found, <code>listnavs()</code> employs various heuristics to get a section's pages, as the <code>Navigation</code> object returned by <code>get_navigation</code> is very incomplete (see these issues: <ahref="https://github.com/fralau/mkdocs-macros-plugin/issues/156">mkdocs-macros-plugin#156</a>, <ahref="https://github.com/fralau/mkdocs-macros-plugin/discussions/198">mkdocs-macro-plugin#198</a>).</p>
840
+
<p><code>listnavs()</code> employs various heuristics to get a section's pages, as the <code>Navigation</code> object returned by <code>get_navigation</code> is very incomplete (see these issues: <ahref="https://github.com/fralau/mkdocs-macros-plugin/issues/156">mkdocs-macros-plugin#156</a>, <ahref="https://github.com/fralau/mkdocs-macros-plugin/discussions/198">mkdocs-macro-plugin#198</a>).</p>
0 commit comments