Options
You can customize the plugin by setting options in mkdocs.yml
. For example:
plugins:
- table-reader:
base_path: "config_dir"
data_path: "."
search_page_directory: True
allow_missing_files: False
select_readers:
- read_csv
- read_json
base_path
The base path where mkdocs-table-reader-plugin
will search for input files. The path to your table files should be relative to the base_path
. Allowed values:
config_dir
(default): the directory where your project'smkdocs.yml
file is located.docs_dir
: the directory where your projects'docs/
folder is located.
If you store your table in docs/assets/table.csv
, you can insert it in any markdown page using {{ read_csv("docs/assets/table.csv") }}
, or when base_path
is docs_dir
, with {{ read_csv("assets/table.csv") }}
.
Info
Note that by default the plugin will also search the page's directory but only when a table is not found.
For more examples see the how to guide on project structure.
data_path
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
.
For example, if your table is located in docs/tables/basic_table.csv
, you can set data_path
to docs/tables/
and leave base_path
to the default config_dir
. Then you will be able to use {{ read_csv("basic_table.csv") }}
instead of {{ read_csv("docs/tables/basic_table.csv") }}
inside any markdown page.
Default is .
, which means you need to specify the path to your table files relative to the base_path
.
Info
Note that by default the plugin will also search the page's directory but only when a table is not found.
For more examples see the how to guide on project structure.
search_page_directory
Default: True
. When enabled, if a filepath is not found, the plugin will also attempt to find the file relative to the current page's directory.
Info
Note that even when True
, the path relative to data_path
is searched first,
and if a file is not found there, then the page's directory is searched.
For more examples see the how to guide on project structure.
allow_missing_files
Default: False
. When enabled, if a filepath is not found, the plugin will raise a warning instead of an error.
select_readers
Default: Selects all available readers. Specify a list of reader to improve documentation build times for large sites.