Skip to content

Fix subreddit normalization - #11

Merged
EthanPlant merged 1 commit into
mainfrom
reddit-normalize
Jul 21, 2026
Merged

EthanPlant merged 1 commit into
mainfrom
reddit-normalize

Conversation

@EthanPlant

Copy link
Copy Markdown
Owner

Summary

Normalize Reddit subreddit configuration values before rendering.

Elsewhere already accepted subreddit names such as r/example, but values written as /r/example were only partially normalized. This produced output like:

r//r/example

This change accepts the following equivalent forms:

example
r/example
/r/example

All three are normalized to:

example

before Elsewhere generates the Reddit preview and structured render artifact.

Changes

  • Add a small normalize_subreddit helper.
  • Trim surrounding whitespace.
  • Remove either an r/ or /r/ prefix.
  • Apply normalization consistently to rendered output and artifact metadata.
  • Add tests covering each supported input form.

Testing

Added unit tests verifying that:

  • example remains example
  • r/example becomes example
  • /r/example becomes example
  • surrounding whitespace is ignored
  • each form renders as Subreddit: r/example

Closes #1

@EthanPlant
EthanPlant merged commit 66dc5db into main Jul 21, 2026
5 checks passed
@EthanPlant
EthanPlant deleted the reddit-normalize branch July 21, 2026 01:34
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.

Normalize Reddit subreddit values

1 participant