Skip to content

Commit 0329d2d

Browse files
authored
Update docs and add deprecation warnings, update gh actions
1 parent ba88bee commit 0329d2d

File tree

10 files changed

+27
-28
lines changed

10 files changed

+27
-28
lines changed

.github/workflows/codespell.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
- name: Checkout
2121
uses: actions/checkout@v4
2222
- name: Codespell
23-
uses: codespell-project/actions-codespell@v2
23+
uses: codespell-project/actions-codespell@v4

.github/workflows/pythonpublish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
id-token: write
1414
contents: write
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717

1818
- name: Set up Python
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: '3.x'
2222

.github/workflows/workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
2929
- name: Upload coverage to Codecov
3030
if: contains(env.USING_COVERAGE, matrix.python-version) && github.ref == 'refs/heads/master'
31-
uses: codecov/codecov-action@v1
31+
uses: codecov/codecov-action@v4
3232
with:
3333
token: ${{ secrets.CODECOV_TOKEN }}
3434
file: ./coverage.xml

CONTRIBUTING.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,3 @@ git push origin <version>
5050
```
5151

5252
Then manually create a github release to trigger publishing to pypi.
53-
54-
55-
TODO:
56-
57-
Changes:
58-
59-
- `macros` should now be defined _before_ `table-reader` (previously after)
60-
- table-reader will now always search docs_dir _and_ config_dir to find a table file. (deprecated option..)
61-
62-
63-
Upgrading guide
64-
65-
- Remove `base_path` and `search_page_directory` options from the config
66-

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ In your markdown files you can now use:
4040

4141
Where the path is relative to the location of your project's `mkdocs.yml` file, _or_ your project's `docs/` directory, _or_ the location of your markdown source file (all 3 possible locations will be searched, in that order).
4242

43-
- There are [readers](https://timvink.github.io/mkdocs-table-reader-plugin/readers/) for `.csv`, `.fwf`, `.json`, `.xlsx`, `.yaml` and `.tsv` files. There is also the `read_raw()` reader that will allow you to insert tables (or other content) already in markdown format.
43+
- There are [readers](https://timvink.github.io/mkdocs-table-reader-plugin/readers/) for `.csv`, `.fwf`, `.json`, `.xls`, `.xlsx`, `.yaml`, `.feather` and `.tsv` files. There is also the `read_raw()` reader that will allow you to insert tables (or other content) already in markdown format.
44+
- `table-reader` is compatible with [`mkdocs-macros-plugin`](https://mkdocs-macros-plugin.readthedocs.io/en/latest/), which means you can [dynamically insert tables using jinja2 syntax](https://timvink.github.io/mkdocs-table-reader-plugin/howto/use_jinja2/).
4445

4546
## Documentation and how-to guides
4647

docs/howto/use_jinja2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Now you can do cool things like dynamically load a list of tables:
1919
{% set table_names = ["basic_table.csv","basic_table2.csv"] %}
2020
{% for table_name in table_names %}
2121

22-
{{ read_csv(table_name) }}
22+
{ { read_csv(table_name) }}
2323

2424
{% endfor %}
2525

26-
```
26+
```

docs/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"type": "object",
1515
"properties": {
1616
"data_path": {
17-
"title": "The path to your table files should be relative to the base_path. If you use a folder for all your table files you can shorten the path specification by setting the data_path.",
17+
"title": "Additional path to search",
1818
"markdownDescription": "https://timvink.github.io/mkdocs-table-reader-plugin/options/#data_path",
1919
"type": "string",
2020
"default": "."

mkdocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ plugins:
5151
- table-reader:
5252
data_path: "docs/assets"
5353
- git-authors:
54-
exclude:
55-
- index.md
54+
exclude:
55+
- index.md
5656
- git-revision-date-localized:
5757
type: timeago
5858
timezone: Europe/Amsterdam
@@ -65,6 +65,7 @@ markdown_extensions:
6565
- meta
6666
- admonition
6767
- pymdownx.keys
68+
- pymdownx.escapeall
6869
- pymdownx.highlight
6970
- pymdownx.inlinehilite
7071
- pymdownx.snippets

mkdocs_table_reader_plugin/plugin.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import os
21
import re
3-
import logging
42

53
from mkdocs.plugins import BasePlugin, get_plugin_logger
64
from mkdocs.config import config_options
@@ -32,9 +30,9 @@ def on_config(self, config, **kwargs):
3230
Config
3331
"""
3432
if "search_page_directory" in self.config:
35-
logger.warning(f"[table-reader]: The 'search_page_directory' configuration option is deprecated, it will always be searched. Please remove it from your mkdocs.yml.")
33+
logger.warning("[table-reader]: The 'search_page_directory' configuration option is deprecated, it will always be searched. Please remove it from your mkdocs.yml.")
3634
if "base_path" in self.config:
37-
logger.warning(f"[table-reader]: The 'base_path' configuration option is deprecated. Both the config_dir and docs_dir will be searched. Please remove it from your mkdocs.yml.")
35+
logger.warning("[table-reader]: The 'base_path' configuration option is deprecated. Both the config_dir and docs_dir will be searched. Please remove it from your mkdocs.yml.")
3836

3937
self.readers = {reader: READERS[reader].set_config_context(mkdocs_config=config, plugin_config=self.config) for reader in self.config.get('select_readers') if reader in self.config.get('select_readers',[])}
4038

tests/test_build.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,16 @@ def test_csv_with_no_string_headers(tmp_path):
374374
page_with_tag = tmp_proj / "site/index.html"
375375
contents = page_with_tag.read_text()
376376
assert re.search(r"4242", contents)
377+
378+
def test_macros_jinja2_syntax(tmp_path):
379+
tmp_proj = setup_clean_mkdocs_folder(
380+
"tests/fixtures/jinja/mkdocs.yml", tmp_path
381+
)
382+
result = build_docs_setup(tmp_proj)
383+
assert result.exit_code == 0, "'mkdocs build' command failed"
384+
385+
# Make sure the file.csv is inserted
386+
page_with_tag = tmp_proj / "site/index.html"
387+
contents = page_with_tag.read_text()
388+
assert re.search(r"531456", contents)
389+

0 commit comments

Comments
 (0)