fix: normalize CRLF line endings in markdown parsers for Windows compatibility #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Markdown files created on Windows use CRLF (\r\n) line endings, which caused the regex patterns in parseProductOverview and parseProductRoadmap to fail matching section headers.
This fix normalizes line endings to LF (\n) before parsing, ensuring cross-platform compatibility.
Problem
Using Cursor on Windows, markdown files (
product-overview.md,product-roadmap.md) are saved with CRLF (\r\n) line endings. The regex patterns inparseProductOverviewandparseProductRoadmapuse\nto match newlines, causing the patterns to fail on Windows systems.This results in the Sections page showing "No roadmap defined yet" even when
product-roadmap.mdexists and is properly formatted.Solution
Added line ending normalization (
md.replace(/\r\n/g, '\n')) at the start of both parser functions before regex matching. This ensures cross-platform compatibility without changing the regex patterns.Documented steps to test
/product-visionto createproduct/product-overview.md/product-roadmapto createproduct/product-roadmap.mdwith 3+ sectionsgit ls-files --eol | grep productnpm run dev/sections)Notes for reviewers
(Sorry for not opening a discussion, just wanted to quickly pass along the fix I used to get past my issue)