DCsunset / pandoc-include

A pandoc filter to allow file and header inclusion
MIT License
67 stars 14 forks source link

No failure when file not found, just insert a missing link. #9

Closed Gullumluvl closed 4 years ago

Gullumluvl commented 4 years ago

Hi, this is a bit of a personal taste and probably mood dependent, but I would rather have the script moving on when a file is not found.

So instead of failing, I propose to insert the filename as a link (broken). The user will notice soon enough, but this allows them to focus on maybe more important issues.

This patch does not implement a warning message. Is this desirable though?

Note: this pull request is incompatible with #8 .

DCsunset commented 4 years ago

I think maybe we could provide an option, for example, include_no_error. If it is set to true, we could insert the filename as a broken. If not, we could throw an error. In this way, we could offer more flexibility.

How do you like it?

Gullumluvl commented 4 years ago

Thanks, yes that would definitely work when calling the script directly. I'm just wondering, how this option could be used when calling the script from the pandoc option --filter=? Maybe exposing a second executable instead (a bit dirty)? Or, reading the include_no_error from the yaml metadata might be better.

DCsunset commented 4 years ago

I think reading it from YAML metadata like other configurations would be better.

DCsunset commented 4 years ago

Since v0.8.1, it uses stderr to print some warnings if no included files are found. So this problem should be solved as well.