Skip to content

Adds new option to limit the length of the generated slugs. #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 18, 2025

Conversation

ctolkien
Copy link
Owner

This is a re-implementation of #50 against the V5 codebase.

Tests have been copypasta'd

Fixes #18

@ctolkien ctolkien requested a review from Copilot March 18, 2025 11:04
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds a new feature that limits the length of generated slugs by incorporating a MaximumLength option in the configuration.

  • Introduces a MaximumLength property to SlugHelperConfiguration.
  • Adds logic in GenerateSlug to trim the slug to the MaximumLength with a check to remove a trailing dash.
  • Provides new test cases in SlugHelperTests to validate this behavior.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/Slugify.Core.Tests/SlugHelperTests.cs Added tests to verify the MaximumLength functionality
src/Slugify.Core/SlugHelper.cs Updated the GenerateSlug method to enforce MaximumLength and remove trailing dashes
src/Slugify.Core/SlugHelperConfiguration.cs Introduced the new MaximumLength property to the configuration

@ctolkien ctolkien merged commit 67aef08 into main Mar 18, 2025
4 checks passed
@ctolkien ctolkien deleted the length-limit branch March 18, 2025 11:30
@Zetanova Zetanova mentioned this pull request Mar 26, 2025
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.

Option for limiting the length of the generated slug
1 participant