jsdoc2md / dmd

The default output template for jsdoc2md
MIT License
39 stars 50 forks source link

Respect line endings #92

Closed jaxer closed 1 month ago

jaxer commented 7 years ago

Generated doc can end up with mixed encodings on windows. Seems like templates (in jsdoc2md packages) are using LF encoding (as they are installed by npm and not converted by git) and windows sources (by default converted by git) use CRLF.

A bigger problem though is unnecessary diffs generated in cross-platform projects. I.e. if doc generated on Mac and later regenerated on Windows then mixed line endings would result in unnecessary diffs.

75lb commented 7 years ago

ok.. so what solution would you like to see? Ensure line-endings in generated docs are consistent? If so, should LF or CRLF be the consistent line-ending used? Or some other solution?

jaxer commented 7 years ago

i think that line-endings should be configurable at best. but at least they should use os.EOL for all output.

yarn had similar problems (https://github.com/yarnpkg/yarn/issues/1061) and they are reusing existing line-endings if destination already exists or using os.EOL otherwise.

jsdoc2md does not have output file defined so i guess making it configurable is a way to go?

75lb commented 1 month ago

Hi, I've implemented an --EOL option - specify either win32 or posix.. For example jsdoc2md --EOL win32 index.js will force the output to use \r\n line-endings throughout.

If you have a moment, feel free to test the prerelease and let me know your thoughts.

npm install -g jsdoc-to-markdown@next
75lb commented 1 month ago

Closing - this feature will be in the next release, watch this space. Let me know if there's anything else.