Add "Remove Unicode Formatting" command to clean Unicode text back to ASCII
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -1,4 +1,4 @@
|
||||
import { BOLD_MAP, ITALIC_MAP, BOLD_ITALIC_MAP } from "./unicode-maps";
|
||||
import { BOLD_MAP, ITALIC_MAP, BOLD_ITALIC_MAP, UNICODE_TO_ASCII_MAP } from "./unicode-maps";
|
||||
|
||||
export type FormatStyle = "bold" | "italic" | "bold-italic";
|
||||
|
||||
@@ -12,3 +12,7 @@ export function transformText(text: string, style: FormatStyle): string {
|
||||
const map = STYLE_MAPS[style];
|
||||
return [...text].map(ch => map[ch] ?? ch).join("");
|
||||
}
|
||||
|
||||
export function cleanText(text: string): string {
|
||||
return [...text].map(ch => UNICODE_TO_ASCII_MAP.get(ch) ?? ch).join("");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user