Skip to content

Commit

Permalink
fix: Remove numbered list formatting from generated tweets issue eliz…
Browse files Browse the repository at this point in the history
…aOS#16

The Twitter post generator was occasionally adding unnecessary numbered list 
formatting to tweets. This update adds regex patterns to clean the content 
by removing:
- Numbered list markers at the start of lines (e.g. "1. ")
- Trailing numbers and periods at the end of tweets

This results in cleaner, more natural-looking tweets without formatting artifacts.
  • Loading branch information
antman1p authored Jan 14, 2025
1 parent 432fbca commit 557c0de
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/client-twitter/src/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,8 @@ export class TwitterPostClient {
.replace(/^['"](.*)['"]$/g, "$1") // Remove quotes
.replace(/\\"/g, '"') // Unescape quotes
.replace(/\\n/g, "\n\n") // Unescape newlines, ensures double spaces
.replace(/^\d+\.\s*/gm, "") // Remove numbered list markers
.replace(/\s*\d+\.\s*$/, "") // Remove trailing numbers
.trim();
}

Expand Down

0 comments on commit 557c0de

Please sign in to comment.