Fix plugin ID, package metadata, and formatter consistency issues
- Correct plugin ID in manifest.json to match folder name (obsidian-unicode-formatter) - Update package.json name and description from sample template defaults - Make markdownToLinkedIn handle both '- ' and '* ' list markers - Enhance cleanText to also strip em-dash, arrow, and numbered-list prefixes
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"id": "unicode-text-formatter",
|
||||
"id": "obsidian-unicode-formatter",
|
||||
"name": "Unicode Text Formatter",
|
||||
"version": "1.0.0",
|
||||
"minAppVersion": "0.15.0",
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "obsidian-sample-plugin",
|
||||
"name": "obsidian-unicode-formatter",
|
||||
"version": "1.0.0",
|
||||
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
||||
"description": "Format selected text as Unicode Sans-Serif Bold, Italic, or Bold-Italic for LinkedIn and Facebook posts.",
|
||||
"main": "main.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
+9
-2
@@ -14,7 +14,14 @@ export function transformText(text: string, style: FormatStyle): string {
|
||||
}
|
||||
|
||||
export function cleanText(text: string): string {
|
||||
return [...text].map(ch => UNICODE_TO_ASCII_MAP.get(ch) ?? ch).join("");
|
||||
return text.split("\n").map(line => {
|
||||
if (line.startsWith("— ")) line = line.slice(2);
|
||||
else if (line.startsWith("→ ")) line = line.slice(2);
|
||||
|
||||
line = line.replace(/^\(\d+\) /, "").replace(/^\d+\/ /, "");
|
||||
|
||||
return [...line].map(ch => UNICODE_TO_ASCII_MAP.get(ch) ?? ch).join("");
|
||||
}).join("\n");
|
||||
}
|
||||
|
||||
export function bulletToEmdash(text: string): string {
|
||||
@@ -79,7 +86,7 @@ export function markdownToLinkedIn(text: string): string {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.startsWith("- ")) {
|
||||
if (line.startsWith("- ") || line.startsWith("* ")) {
|
||||
if (!inListContext) {
|
||||
for (let i = 0; i < pendingBlanks; i++) output.push("");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user