-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
panflute.yaml_filter: error handling when YAML is invalid #23
Comments
I agree that Python errors should not be allowed to occur. We could just wrap the YAML reader in a |
In addition to a warning message in command-line, how about it returns the By the way, I tested invalid YAML in pandoc and it will do: $ printf "%s\n" '---' 'title: *unquoted*' '---' '' 'non-empty' | pandoc -f markdown -t native --css=abc.css
pandoc: Could not parse YAML header: did not find expected alphabetic or numeric character "source" (line 3, column 17)
Pandoc (Meta {unMeta = fromList []})
[Para [Str "non-empty"]] |
I wrote the code for the soft error handling, but I think that at least for now the better alternative is not to run the filter at all:
|
I finished my filter in ickc/pantable: CSV Tables in Markdown: Pandoc Filter for CSV Tables. It's based on your csv example but eventually breaks compatibility with it. One potential problem is exactly what you said above: I handle away all errors in the YAML metadata and override them with "sensible defaults". |
I'm writing a test on invalid YAML:
which would gives this error:
I'm thinking how to handle the error. May be an option can be given to panflute.yaml_filter such that it will do nothing (leave the code block as is) rather than raising an error?
The text was updated successfully, but these errors were encountered: