Skip to content

feat: add Clean Paste (Dán sạch) text normalization - #344

Open
khaphanspace wants to merge 1 commit into
mainfrom
feat/clean-paste-text-normalization
Open

feat: add Clean Paste (Dán sạch) text normalization#344
khaphanspace wants to merge 1 commit into
mainfrom
feat/clean-paste-text-normalization

Conversation

@khaphanspace

Copy link
Copy Markdown
Owner

Summary

  • Add "Dán sạch" feature: hotkey-triggered clipboard text cleaning with platform-aware markdown conversion
  • Rust core module (cross-platform reusable) with 44 unit tests
  • Auto-detects target app (Discord/Slack/Telegram/Zalo/FB) and converts markdown format accordingly
  • Customizable character mapping table + configurable hotkey (default: Cmd+Shift+V)

Changes

File What
core/src/clean_text.rs NEW: text normalization + markdown conversion + 44 tests
core/src/lib.rs FFI function ime_clean_text
platforms/macos/AdvancedSettingsView.swift UI section + char mapping sheet
platforms/macos/MainSettingsView.swift CleanPasteMapping model + AppState
platforms/macos/RustBridge.swift FFI bridge + hotkey detection + clipboard logic
platforms/macos/AppMetadata.swift Settings keys + shortcut loader

Test plan

  • 44 Rust unit tests pass (char replacement, format rules, platform markdown)
  • Full test suite: 970+ tests pass, 0 fail
  • macOS build succeeds
  • Manual test: copy messy text → Cmd+Shift+V in Discord/Zalo/editor
  • Manual test: customize char mappings and hotkey in Advanced settings

@khaphanspace
khaphanspace force-pushed the feat/clean-paste-text-normalization branch from 14c4088 to fb8f202 Compare March 16, 2026 09:14
Hotkey-triggered clipboard text cleaning with platform-aware markdown
conversion. Cmd+Shift+V (configurable) reads clipboard, normalizes
text, and pastes the cleaned version.

Features:
- Char replacement: smart quotes, em dash, bullets, zero-width chars
- Format normalization: collapse blank lines, compact nested bullets,
  join after colon/heading, trim spaces, strip backslash escapes
- Platform-aware markdown: auto-detects target app and converts
  headings/tables/links/bold/italic for Discord, Slack, Telegram,
  Zalo, Facebook, iMessage, etc.
- Strip **bold** from heading text (Google Docs/Notion export compat)
- Simplify redundant links [url](url) → url
- Customizable char mapping table + configurable hotkey
- Preserve nested bullet indent levels
- 53 unit tests, all existing 970+ tests pass
@khaphanspace
khaphanspace force-pushed the feat/clean-paste-text-normalization branch from fb8f202 to b870398 Compare March 16, 2026 15:57
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