Re-instate preserving of line endings
Preamble
Hi Simon, it looks to me like #22 might have got un-fixed at some time.
Here's what's happening...
Describe the bug
A clear and concise description of what the bug is. Include any relevant version information.
On macOS, running:
mdsnippets --version
mdsnippets 24.2.2+78ae4cdf92e0c9f14cb7b822c6464773569e6b56
with this configuration:
{
"$schema": "https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/schema.json",
"ExcludeDirectories": [ "node_modules" ],
"Convention": "InPlaceOverwrite",
"TocLevel": 5
}
... I find that all my .md files are converted from LF end-of-lines to CRLF

I actually don't yet have any snippets or toc lines. I just wanted to make sure that I could run the tool, having not used it for a while.
A clear and concise description of what you expected to happen.
Add any other context about the problem here.
I would like mdsnippets to preserve the line-endings of the input file. It used to do th
Minimal Repro
Ensure you have replicated the bug in a minimal solution with the fewest moving parts. Often this will help point to the true cause of the problem. Upload this repro as part of the issue, preferably a public GitHub repository or a downloadable zip. The repro will allow the maintainers of this project to smoke test the any fix.
Please let me know if you need that.
Submit a PR that fixes the bug
Submit a Pull Request (PR) that fixes the bug. Include in this PR a test that verifies the fix. If you were not able to fix the bug, a PR that illustrates your partial progress will suffice.
Sorry, unable to do that with my current skills.
I looked at the issue #22 to see if it linked to a specific commit, in which case I would have looked through the repo at the history of the relevant lines...
@SimonCropp There is something weird going on. It's not happening now on my Mac. So the answer is that a minimal repro is needed. I'll close this for now, and re-open it if I can figure out what changed...
@claremacrae AFAIK i havnt tweaked anything that should have changed that behaviour. let me know if u want to jump on a call so u can show the the problem
Thank you @SimonCropp. I will indeed do that, if I get to the stage that I'm using mdsnippets for real on the project.
(For background, I'm working towards using Approval Tests on this project (TypeScript with Jest test framework), and when that's working, if I still have this problem I'll get back to you. It's embedding markdown samples inside markdown files, which doesn't seem to be playing nicely with mdsnippets - a separate issue.)
@claremacrae AFAIK i havnt tweaked anything that should have changed that behaviour. let me know if u want to jump on a call so u can show the the problem
Hi Simon, I believe I have now normalised all the line endings in my repo, and still mdsnippets is converting all files it processes to CRLF on Mac.
I would love to show you where I've got to. I'll email...
Just in case it helps anyone else here, I've found a series of steps to run mdsnippets that works for my current project, obsidian-tasks:
mdsnippets && yarn run lint:markdown && git add --renormalize .
The two issues the above solves are:
- the project is configured to use
-characters for bullet points- mdsnippets processes
toclines and adds list items beginning*- so runningyarn run lint:markdowninvokesmarkdownlint-cli2-fixto convert the*to- - details of that step are in the project's package.json file
- mdsnippets processes
- on Mac, even with all input files having
LFas line endings, mdsnippets writes out files withCRLFendingsgit add --renormalize .converts them back toLF