With macros enabled, we want to be able to do something like this:
{{ read_csv("basic_table.csv").query("a > 40") }}
That fails with jinja2.exceptions.UndefinedError: 'str object' has no attribute 'query'.
That's because read_csv is actually doing both reading the file and creating the markdown table, and returning the string.
We could register a couple of additional macros, one for each reader, such as: pd_read_csv. That will return a pandas DataFrame that we can process with .query for example.
We also then need to register a filter like convert_to_md_table that does the tabulation for us.
With macros enabled, we want to be able to do something like this:
That fails with
jinja2.exceptions.UndefinedError: 'str object' has no attribute 'query'
.That's because
read_csv
is actually doing both reading the file and creating the markdown table, and returning the string.We could register a couple of additional macros, one for each reader, such as:
pd_read_csv
. That will return a pandas DataFrame that we can process with.query
for example.We also then need to register a filter like
convert_to_md_table
that does the tabulation for us.What then would work is:
After we get that working, we should also:
https://github.com/squidfunk/mkdocs-material/discussions/3315#discussioncomment-5066920