fd74c0987e
- Add unicode-maps.ts with BOLD_MAP, ITALIC_MAP, BOLD_ITALIC_MAP from Unicode Sans-Serif ranges - Add formatter.ts with transformText(text, style) using the maps - Add commands.ts registering three editorCallback commands (bold, italic, bold-italic) - Replace sample plugin boilerplate in main.ts with UnicodeFormatterPlugin wired to registerCommands - Update manifest.json with correct id, name, and description - Delete unused settings.ts boilerplate Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
function buildMap(
|
||
upperStart: number,
|
||
lowerStart: number,
|
||
digitStart?: number
|
||
): Record<string, string> {
|
||
const map: Record<string, string> = {};
|
||
for (let i = 0; i < 26; i++) {
|
||
map[String.fromCharCode(65 + i)] = String.fromCodePoint(upperStart + i);
|
||
map[String.fromCharCode(97 + i)] = String.fromCodePoint(lowerStart + i);
|
||
}
|
||
if (digitStart !== undefined) {
|
||
for (let i = 0; i < 10; i++) {
|
||
map[String.fromCharCode(48 + i)] = String.fromCodePoint(digitStart + i);
|
||
}
|
||
}
|
||
return map;
|
||
}
|
||
|
||
// Sans-Serif Bold: U+1D5D4–U+1D5ED (upper), U+1D5EE–U+1D607 (lower), U+1D7EC–U+1D7F5 (digits)
|
||
export const BOLD_MAP: Record<string, string> = buildMap(0x1D5D4, 0x1D5EE, 0x1D7EC);
|
||
|
||
// Sans-Serif Italic: U+1D608–U+1D621 (upper), U+1D622–U+1D63B (lower)
|
||
export const ITALIC_MAP: Record<string, string> = buildMap(0x1D608, 0x1D622);
|
||
|
||
// Sans-Serif Bold-Italic: U+1D63C–U+1D655 (upper), U+1D656–U+1D66F (lower)
|
||
export const BOLD_ITALIC_MAP: Record<string, string> = buildMap(0x1D63C, 0x1D656);
|