timvink / mkdocs-table-reader-plugin

MkDocs plugin that enables a markdown tag like {{ read_csv('table.csv') }} to directly insert various table formats into a page
https://timvink.github.io/mkdocs-table-reader-plugin/
MIT License
111 stars 18 forks source link

Conflict with mkdocs-markdownextradata-plugin #20

Closed G3rtjan closed 2 years ago

G3rtjan commented 2 years ago

When using both the mkdocs-markdownextradata-plugin and this mkdocs-table-reader-plugin, there is a conflict when using the {{ read_csv("table.csv") }} (and other) placeholders from mkdocs-table-reader-plugin which are tried to be interpreted as mkdocs-markdownextradata-plugin placeholders.

When running mkdocs serve on docs containing {{ read_csv("table.csv") }}, then an error occurs: jinja2.exceptions.UndefinedError: 'read_csv' is undefined. This seems to be caused by the mkdocs-table-reader-plugin placeholders to be trying to be interpreted as mkdocs-markdownextradata-plugin placeholders, because both rely on the same {{ placeholder }} pattern within the markdown docs.

A temporary solution is to specify a different placeholder pattern for mkdocs-markdownextradata-plugin in the mkdocs.yml:

plugins:
    - search
    - markdownextradata:
        jinja_options:
            variable_start_string: "{{{"
            variable_end_string: "}}}"
timvink commented 2 years ago

This is related to https://github.com/timvink/mkdocs-table-reader-plugin/issues/14

Solution could be to raise a similar error:

https://github.com/timvink/mkdocs-table-reader-plugin/blob/45e3105e364d70f0ecd72b3b2935ff0ed0b257fe/mkdocs_table_reader_plugin/plugin.py#L84-L86