ml-tooling / lazydocs

📖 Generate markdown API documentation from Google-style Python docstring. The lazy alternative to Sphinx.
MIT License
205 stars 38 forks source link

Fix 'character maps to <undefined>' issue on windows #22

Closed alx00x closed 3 years ago

alx00x commented 3 years ago

Fixes #21

raethlein commented 3 years ago

Hey @koaleksa, thanks a lot for the PR and fixing the issue! I was just wondering whether this could break the behavior in certain cases / for certain users where the markdown file was not saved as 'utf-8'? I think this is still much better than leaving it out as in the original, though. But maybe we should make the default 'utf-8' overridable via a CLI argument? Do you have any thoughts about this?

alx00x commented 3 years ago

Hi @raethlein, there are probably very few reasons why one would want to write a text file (markdown in particular) with any other encoding these days. An argument could be made, of course... If there are such users, the code will still run for them as function simply opens the file in write mode and replaces the content, but the encoding will indeed change for them under their feet.

I think, for a lightweight tool, I'd advocate for keeping things simple and adding options only when there's specific expressed interest, rather than going by unlikely scenarios. However, a CLI override would be trivial to implement so if you'd still prefer to expose the option, I'll be happy to amend this PR.

Thank you guys for the awesome tool, btw. 👍

For some interesting read on this topic, I suggest having a look at PEP597

raethlein commented 3 years ago

Thanks a lot for your detailed thoughts and I totally agree with your assessment! I am going to merge it then :)