Releases: darkmavis1980/markdown-index-generator
v3.2.1
Fix: Inconsistent TOC generation due to line endings
This PR resolves issue #74, where the Table of Contents (TOC) was being generated inconsistently, particularly on macOS environments. The root cause was identified as the parser's assumption of \n line endings, which failed to account for files with \r\n or \r.
Changes Made
- Normalized Line Endings: The
MarkdownParsernow normalizes line endings by replacing\r\nand\rwith\nbefore splitting the file content into lines. This ensures consistent parsing across all operating systems. - Added Test Case: A new test has been added to specifically verify that the parser correctly handles mixed line endings (
\n,\r\n, and\r), preventing future regressions.
With these changes, the TOC generation is now consistent and reliable, regardless of the file's line endings.
v3.2.0
🚀 Release v3.2.0: Enhanced Markdown Parsing and Permalink Generation
📋 Overview
This release introduces significant improvements to the Markdown parsing capabilities and permalink generation, along with comprehensive dependency updates and enhanced test coverage.
✨ What's New
🔧 Enhanced Markdown Parser
- Improved heading extraction: Better handling of complex heading structures
- Enhanced code block handling: More robust parsing of code blocks within markdown content
- Streamlined whitespace management: Consistent handling of various whitespace patterns
Advanced Permalink Generation
- HTML tag support: The
stringToPermalinkfunction now properly handles HTML tags - Markdown link processing: Improved handling of markdown link syntax
- Trailing hyphen removal: Cleaner permalink generation by removing trailing hyphens
Test Improvements
- Consistent test cases: Updated test scenarios for better reliability
- Code cleanup: Removed unused imports and improved test structure
- Enhanced coverage: Better test coverage for edge cases
Dependency Updates
- Latest TypeScript: Updated to TypeScript 5.9.2
- Modern ESLint: Upgraded to ESLint 9.33.0 with latest TypeScript-ESLint
- Performance improvements: Updated tsx, Jest, and other development dependencies
🔍 Technical Details
Files Modified
src/classes/markdown.ts- Enhanced MarkdownParser functionalitysrc/lib/utils.ts- Improved permalink generationtest/__mocks__/test.md- Updated test datatest/esm-compatibility.test.ts- Enhanced ESM testingtest/lib/tags.test.ts- Improved tag parsing testspackage.json&package-lock.json- Dependency updatesCHANGELOG.md- Release documentation
Breaking Changes
None - this is a backward-compatible release.
Quality Assurance
- ✅ All existing tests pass
- ✅ New test cases added for enhanced functionality
- ✅ Code follows project linting standards
- ✅ ESM compatibility maintained
- ✅ Node.js 22+ compatibility ensured
📈 Impact
This release improves the reliability and robustness of markdown parsing, making the tool more suitable for complex markdown documents with various formatting patterns. The enhanced permalink generation ensures cleaner, more consistent output for generated indexes.
🔗 Related
- Version: 3.2.0
- Branch:
bugfix/fix-issue-77 - Previous: v3.1.4
v3.1.4
v3.1.3
Changes
- fix: updated list of node.js runtime versions
- fix: compatibility issue with ts-jest
- chore: update all dependencies to latest version
v3.1.2
Fix issue with spaces in headings and multi-digit numbered lists
Summary
This PR addresses two key issues in the Markdown Index Generator:
- Improves whitespace handling in headings to ensure proper normalization
- Fixes a bug in the numbered list detection that failed to recognize multi-digit numbers (e.g., "10.")
Changes
- Updated the regex pattern in
getListStylemethod to use\d+instead of\dto match multiple digits - Enhanced whitespace handling in
parseHeadingsby adding proper normalization withreplace(/\s+/g, ' ') - Added comprehensive unit tests for:
- Headings with excessive whitespace
- Multi-digit numbered list detection
- Whitespace normalization
- Custom title filtering
Testing
All tests are passing, including the new tests specifically created to verify these fixes.
Related Issue
Closes #70
v3.1.1
Fix issue with headings containing extra whitespace
Problem
The markdown index generator wasn't properly handling headings that contained multiple consecutive whitespace characters (spaces, tabs, newlines). This resulted in invalid permalinks with multiple hyphens or inconsistent formatting.
Solution
This PR adds proper whitespace handling to the stringToPermalink function:
- Added
.trim()to remove leading and trailing whitespace - Added
.replace(/\s+/g, ' ')to replace multiple whitespace characters with a single space - Enhanced existing tests and added new tests specifically for whitespace handling
Changes
- Fixed whitespace normalization in the
stringToPermalinkfunction - Added comprehensive test suite for whitespace handling in headings
- Added additional tests to validate ESM compatibility and import paths
- Ensured formatting consistency throughout the codebase
- Fix issue with workflows
Test Cases Added
- Multiple spaces within headings
- Tabs in headings
- Newlines in headings
- Leading and trailing whitespace in headings
Related Issues
Fixes Issue #70
Version
This is a bugfix that should be released as version 3.1.1
v3.1.0
Refactor Build Process and Fix ESM Compatibility
Overview
This PR updates the project to properly support ESM modules with proper import/export paths, fixing compatibility issues between Node.js environments including Windows WSL.
Changes
ESM Module Compatibility
- Added
.jsextensions to all import paths in TypeScript files - Updated
tsconfig.jsonto useNodeNextfor module resolution - Fixed exports to ensure proper ESM compatibility
- Fixed shebang in bin/run to work across different environments including Windows WSL
Testing Infrastructure
- Updated Jest configuration to work with ES modules
- Added
NODE_OPTIONS=--experimental-vm-modulesto test scripts - Imported Jest from
@jest/globalsin test files to support ESM compatibility
Export Consistency
- Removed conflicting export patterns in
markdown.ts - Standardized named exports across the codebase
Testing
- All tests are passing with the updated configuration
- The library now correctly builds with TypeScript to ESM-compatible JavaScript
- Fixed import paths to ensure compatibility when used as a dependency
Impact
These changes resolve issues where:
- The library would fail when imported in other ESM projects
- The library wouldn't work correctly in Windows WSL environments
- Module paths were resolved incorrectly (e.g.
/lib/lib/utilsinstead of/lib/utils)
Version
Bumped version to 3.1.0 as these changes include significant internal improvements but don't break the external API.
v3.0.3
v3.0.1
Changes
- fix: issue with TS configuration during publishing
v3.0.0
Changes
- feat!: dropped support for node.js 18.x, supported versions are 20.x and above
- feat: update ESLint to version 9
- feat: added prettier for formatting
- feat: replaced runtime for CLI
- fix: removed mocha configuration
- fix: various configurations
- chore: update dependencies