Skip to content

Add text wrap#11

Merged
marjmandi merged 7 commits intomainfrom
add-text-wrap
Sep 3, 2025
Merged

Add text wrap#11
marjmandi merged 7 commits intomainfrom
add-text-wrap

Conversation

@marjmandi
Copy link
Owner

Pull Request

Description

This PR enhances the textify function and the preserveFormat utility by adding options to wrap output text.

  • Added wrapWords to limit the number of words per line.
  • Added wrapLength to limit the number of characters per line.
  • Updated textify to apply these wrapping options while preserving existing formatting and ignored tags.
  • Added comprehensive JSDoc for textify and preserveFormat.
  • Updated examples and README to document the new wrapping features.

These changes improve usability for emails, logs, or any text-only output where line length or word count is important.

Related Issue(s)

Closes #

Type of Change

  • Bug fix
  • New feature
  • Refactor / Optimization
  • Documentation
  • Other (please describe)

How Has This Been Tested?

  • Unit tests added for wrapByWords and wrapByLength.
  • Tests for textify updated to cover:
    • wrapWords wrapping
    • wrapLength wrapping
    • combination of ignored tags and wrapping
  • Manual testing in Node.js environment to verify formatting and output consistency.

Checklist

  • My code follows the project’s style guidelines
  • I have performed a self-review of my own code
  • I have commented my code where necessary
  • I have updated the documentation if necessary
  • All tests pass
  • Any dependent changes have been merged

Additional Notes

  • Wrapping by words takes priority over wrapping by character length if both are provided.
  • Edge cases, such as long words exceeding wrapLength, are preserved without splitting.
  • This PR also prepares the codebase for potential automated changelog generation by following semantic commit conventions.

@marjmandi marjmandi merged commit a404c8c into main Sep 3, 2025
1 check passed
@marjmandi marjmandi deleted the add-text-wrap branch September 3, 2025 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant