Skip to content

Commit

Permalink
Deployed 47ac5d5 with MkDocs version: 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow authored Aug 26, 2024
1 parent ef14936 commit 1868264
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 28 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand Down
2 changes: 1 addition & 1 deletion assets/tables/markdown_table/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand Down
2 changes: 1 addition & 1 deletion howto/alternatives/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand Down
2 changes: 1 addition & 1 deletion howto/customize_tables/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand Down
2 changes: 1 addition & 1 deletion howto/docker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand Down
15 changes: 10 additions & 5 deletions howto/preprocess_tables/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand Down Expand Up @@ -735,6 +735,10 @@ <h2 id="combine-a-directory-of-tables-into-a-single-larger-table">Combine a dire
</div>
</div>
</div>
<div class="admonition note">
<p class="admonition-title">Alternative: use jinja</p>
<p>You can also use jinja2 to display a list of tables. See how to <a href="../use_jinja2/">use jinja2 for automation</a>.</p>
</div>
<h2 id="download-a-table-from-an-api">Download a table from an API</h2>
<div class="tabbed-set tabbed-alternate" data-tabs="2:4"><input checked="checked" id="__tabbed_2_1" name="__tabbed_2" type="radio" /><input id="__tabbed_2_2" name="__tabbed_2" type="radio" /><input id="__tabbed_2_3" name="__tabbed_2" type="radio" /><input id="__tabbed_2_4" name="__tabbed_2" type="radio" /><div class="tabbed-labels"><label for="__tabbed_2_1">hooks.py</label><label for="__tabbed_2_2">index.md</label><label for="__tabbed_2_3">mkdocs.yml</label><label for="__tabbed_2_4">Project structure</label></div>
<div class="tabbed-content">
Expand Down Expand Up @@ -794,7 +798,7 @@ <h2 id="download-a-table-from-an-api">Download a table from an API</h2>
<span class="md-icon" title="Last update">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1-2.1-2M12.5 7v5.2l4 2.4-1 1L11 13V7h1.5M11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2v1.8Z"/></svg>
</span>
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-timeago"><span class="timeago" datetime="2023-01-30T14:01:40+01:00" locale="en"></span></span><span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-iso_date">2023-01-30</span>
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-timeago"><span class="timeago" datetime="2024-08-26T16:20:18+02:00" locale="en"></span></span><span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-iso_date">2024-08-26</span>
</span>


Expand All @@ -805,12 +809,13 @@ <h2 id="download-a-table-from-an-api">Download a table from an API</h2>
<span class="md-source-file__fact">
<span class="md-icon" title="Contributors">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 4a4 4 0 0 1 4 4 4 4 0 0 1-4 4 4 4 0 0 1-4-4 4 4 0 0 1 4-4m0 10c4.42 0 8 1.79 8 4v2H4v-2c0-2.21 3.58-4 8-4Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 5.5A3.5 3.5 0 0 1 15.5 9a3.5 3.5 0 0 1-3.5 3.5A3.5 3.5 0 0 1 8.5 9 3.5 3.5 0 0 1 12 5.5M5 8c.56 0 1.08.15 1.53.42-.15 1.43.27 2.85 1.13 3.96C7.16 13.34 6.16 14 5 14a3 3 0 0 1-3-3 3 3 0 0 1 3-3m14 0a3 3 0 0 1 3 3 3 3 0 0 1-3 3c-1.16 0-2.16-.66-2.66-1.62a5.536 5.536 0 0 0 1.13-3.96c.45-.27.97-.42 1.53-.42M5.5 18.25c0-2.07 2.91-3.75 6.5-3.75s6.5 1.68 6.5 3.75V20h-13v-1.75M0 20v-1.5c0-1.39 1.89-2.56 4.45-2.9-.59.68-.95 1.62-.95 2.65V20H0m24 0h-3.5v-1.75c0-1.03-.36-1.97-.95-2.65 2.56.34 4.45 1.51 4.45 2.9V20Z"/></svg>

</span>
<nav>

<a href="mailto:[email protected]">Tim Vink</a>
<a href="mailto:[email protected]">Tim Vink</a>,
<a href="mailto:[email protected]">Tim Vink</a>
</nav>
</span>

Expand All @@ -827,7 +832,7 @@ <h2 id="download-a-table-from-an-api">Download a table from an API</h2>

<div class="md-source-date">
<small>
Authors: <span class='git-page-authors git-authors'><a href='mailto:[email protected]'>Tim Vink</a></span>
Authors: <span class='git-page-authors git-authors'><a href='mailto:[email protected]'>Tim Vink</a>, <a href='mailto:[email protected]'>Tim Vink</a></span>
</small>
</div>

Expand Down
2 changes: 1 addition & 1 deletion howto/project_structure/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand Down
96 changes: 83 additions & 13 deletions howto/use_jinja2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@



<title>Using jinja2 - mkdocs-table-reader-plugin</title>
<title>Use jinja2 for automation - mkdocs-table-reader-plugin</title>



Expand Down Expand Up @@ -76,7 +76,7 @@
<div data-md-component="skip">


<a href="#using-jinja2" class="md-skip">
<a href="#use-jinja2-for-automation" class="md-skip">
Skip to content
</a>

Expand Down Expand Up @@ -112,7 +112,7 @@
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">

Using jinja2
Use jinja2 for automation

</span>
</div>
Expand Down Expand Up @@ -477,7 +477,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand All @@ -488,7 +488,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand All @@ -510,9 +510,27 @@
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>

<li class="md-nav__item">
<a href="#indented-content-like-content-tabs" class="md-nav__link">
<a href="#dynamically-load-a-list-of-tables" class="md-nav__link">
<span class="md-ellipsis">
Indented content like content tabs
Dynamically load a list of tables
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#insert-tables-into-content-tabs" class="md-nav__link">
<span class="md-ellipsis">
Insert tables into content tabs
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#recursively-insert-an-entire-directory-of-tables" class="md-nav__link">
<span class="md-ellipsis">
Recursively insert an entire directory of tables
</span>
</a>

Expand Down Expand Up @@ -644,9 +662,27 @@
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>

<li class="md-nav__item">
<a href="#indented-content-like-content-tabs" class="md-nav__link">
<a href="#dynamically-load-a-list-of-tables" class="md-nav__link">
<span class="md-ellipsis">
Dynamically load a list of tables
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#insert-tables-into-content-tabs" class="md-nav__link">
<span class="md-ellipsis">
Indented content like content tabs
Insert tables into content tabs
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#recursively-insert-an-entire-directory-of-tables" class="md-nav__link">
<span class="md-ellipsis">
Recursively insert an entire directory of tables
</span>
</a>

Expand All @@ -668,14 +704,15 @@



<h1 id="using-jinja2">Using jinja2</h1>
<h1 id="use-jinja2-for-automation">Use jinja2 for automation</h1>
<p><code>table-reader</code> supports <a href="https://mkdocs-macros-plugin.readthedocs.io/en/latest/"><code>mkdocs-macros-plugin</code></a>, which enables you to use jinja2 syntax inside markdown files (among other things).</p>
<p>To enable <code>macros</code>, specify the plugin <em>before</em> <code>table-reader</code> in your <code>mkdocs.yml</code> file:</p>
<div class="highlight"><pre><span></span><code><span class="nt">plugins</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">macros</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">table-reader</span>
</code></pre></div>
<p>Now you can do cool things like dynamically load a list of tables:</p>
<p>Now you can do cool things like:</p>
<h2 id="dynamically-load-a-list-of-tables">Dynamically load a list of tables</h2>
<div class="highlight"><pre><span></span><code><span class="gh"># index.md</span>

{% set table_names = [&quot;basic_table.csv&quot;,&quot;basic_table2.csv&quot;] %}
Expand All @@ -685,7 +722,7 @@ <h1 id="using-jinja2">Using jinja2</h1>

{% endfor %}
</code></pre></div>
<h2 id="indented-content-like-content-tabs">Indented content like content tabs</h2>
<h2 id="insert-tables-into-content-tabs">Insert tables into content tabs</h2>
<p>If you inserted content has multiple lines, then indentation will be not be retained beyond the first line. This means things like <a href="https://squidfunk.github.io/mkdocs-material/reference/content-tabs/#usage">content tabs</a> will not work as expected.</p>
<p>To fix that, you can use the custom <em>filter</em> <code>add_indendation</code> (a filter add to <code>macros</code> by <code>table-reader</code> plugin). For example:</p>
<div class="tabbed-set tabbed-alternate" data-tabs="1:2"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><input id="__tabbed_1_2" name="__tabbed_1" type="radio" /><div class="tabbed-labels"><label for="__tabbed_1_1">index.md</label><label for="__tabbed_1_2">mkdocs.yml</label></div>
Expand Down Expand Up @@ -726,6 +763,39 @@ <h2 id="indented-content-like-content-tabs">Indented content like content tabs</
<p>To avoid the tables being inserted into the code example, we replaced <code>{{</code> with <code>{ {</code>.
If you copy this example, make sure to fix.</p>
</div>
<h2 id="recursively-insert-an-entire-directory-of-tables">Recursively insert an entire directory of tables</h2>
<p><a href="https://mkdocs-macros-plugin.readthedocs.io/en/latest/"><code>mkdocs-macros-plugin</code></a> enables you to define additional functions (called <em>macros</em>) that you will be able to use within your markdown files.
See their documentation on how to set this up. Here's an example with some functions to interact with the filesystem:</p>
<div class="highlight"><pre><span></span><code><span class="k">def</span> <span class="nf">define_env</span><span class="p">(</span><span class="n">env</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Register additional mkdocs-macros-plugin functions that can be used as macros in markdown files.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="nd">@env</span><span class="o">.</span><span class="n">macro</span>
<span class="k">def</span> <span class="nf">listdir</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
<span class="k">return</span> <span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>

<span class="nd">@env</span><span class="o">.</span><span class="n">macro</span>
<span class="k">def</span> <span class="nf">path_exists</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
<span class="k">return</span> <span class="n">Path</span><span class="p">(</span><span class="n">path</span><span class="p">)</span><span class="o">.</span><span class="n">exists</span><span class="p">()</span>

<span class="nd">@env</span><span class="o">.</span><span class="n">macro</span>
<span class="k">def</span> <span class="nf">is_file</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
<span class="k">return</span> <span class="n">Path</span><span class="p">(</span><span class="n">path</span><span class="p">)</span><span class="o">.</span><span class="n">is_file</span><span class="p">()</span>
</code></pre></div>
<p>Now you could do something like:</p>
<div class="highlight"><pre><span></span><code><span class="gh"># index.md</span>

{% for table_name in listdir(&#39;docs/assets/my_tables&quot;) %}

{ { read_csv(table_name) }}

{% endfor %}
</code></pre></div>
<div class="admonition note">
<p class="admonition-title">Note the space in { {</p>
<p>To avoid the tables being inserted into the code example, we replaced <code>{{</code> with <code>{ {</code>.
If you copy this example, make sure to fix.</p>
</div>



Expand All @@ -746,7 +816,7 @@ <h2 id="indented-content-like-content-tabs">Indented content like content tabs</
<span class="md-icon" title="Last update">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1-2.1-2M12.5 7v5.2l4 2.4-1 1L11 13V7h1.5M11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2v1.8Z"/></svg>
</span>
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-timeago"><span class="timeago" datetime="2024-08-15T15:49:57+02:00" locale="en"></span></span><span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-iso_date">2024-08-15</span>
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-timeago"><span class="timeago" datetime="2024-08-26T16:20:18+02:00" locale="en"></span></span><span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-iso_date">2024-08-26</span>
</span>


Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand Down
2 changes: 1 addition & 1 deletion options/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand Down
2 changes: 1 addition & 1 deletion readers/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@


<span class="md-ellipsis">
Using jinja2
Use jinja2 for automation
</span>


Expand Down
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

Binary file modified sitemap.xml.gz
Binary file not shown.

0 comments on commit 1868264

Please sign in to comment.