Closed heavyneptune closed 1 month ago
allow_missing_files
is meant to raise a warning instead of an error when a file path is not present.
Parsing errors are a different situation. I didn't forsee that use case. What about a new, additional option allow_parsing_errors
? Or is allow_loading_errors
clearer for users?
Would you be open to creating a PR ?
I guess allow_parsing_errors or a warn_on_parsing_failure, but the second might drive all_missing_files to move to warn_on_missing_files. Your choice.
Thought about this more. Before we create a swiss army knife full of options, I'd like to understand the use case here. Why not just disable the plugin if you don't want to deal with errors? Or remove the jinja2 tag?
Are you generating the tables? If you, try changing the order of the plugins, or using a different (earlier) hook.
I didn't ask for another switch. The current switch handles an error as a warning (missing file), I'd like to apply the same rule for malformed files. You could rename it to warn_on_error and include some handling to look for the old switch name if present.
allow_missing_files
missing files is something else than allow_errors
or alllow_malformed_files
. I am not convinced this is a an option that many people might need, and I want to keep the plugin as simple as possible.
If you temporarily want to disable the plugin, I suggest you set the enabled
option to false instead (see https://www.mkdocs.org/user-guide/configuration/#enabled-option). If that doesn't fit your exact use-case, you can fork the repo, I added an MIT-license.
Thanks for discussing the option though!
The allow_missing_files configuration is typically used when the creation of the content by mkdocs is more important than the availability of the file. It does not handle malformed files. Can you update the function TableReaderPlugin.on_page_markdown() to properly handle the Pandas errors by supplementing
markdown_table = function(valid_file_paths[0], *pd_args, **pd_kwargs)
?