diff --git a/README.md b/README.md index 8ffa20e..d45a707 100644 --- a/README.md +++ b/README.md @@ -1,90 +1,76 @@ -# Obsidian Sample Plugin +# Unicode Text Formatter -This is a sample plugin for Obsidian (https://obsidian.md). +An [Obsidian](https://obsidian.md) plugin that transforms selected text into Unicode Mathematical Alphanumeric Symbols — Sans-Serif Bold, Italic, and Bold-Italic — for use in LinkedIn and Facebook posts. -This project uses TypeScript to provide type checking and documentation. -The repo depends on the latest plugin API (obsidian.d.ts) in TypeScript Definition format, which contains TSDoc comments describing what it does. +## Features -This sample plugin demonstrates some of the basic functionality the plugin API can do. -- Adds a ribbon icon, which shows a Notice when clicked. -- Adds a command "Open modal (simple)" which opens a Modal. -- Adds a plugin setting tab to the settings page. -- Registers a global click event and output 'click' to the console. -- Registers a global interval which logs 'setInterval' to the console. +- **Unicode Bold** — converts letters and digits to sans-serif bold (𝗔𝗕𝗖 / 𝗮𝗯𝗰 / 𝟬𝟭𝟮) +- **Unicode Italic** — converts letters to sans-serif italic (𝘈𝘉𝘊 / 𝘢𝘣𝘤) +- **Unicode Bold Italic** — converts letters to sans-serif bold italic (𝘼𝘽𝘾 / 𝙖𝙗𝙘) +- Non-mapped characters (punctuation, spaces, emoji, etc.) are passed through unchanged -## First time developing plugins? +## Usage -Quick starting guide for new plugin devs: +1. Select text in the editor +2. Open the Command Palette (`Ctrl/Cmd + P`) +3. Run one of: + - **Format as Unicode Bold** + - **Format as Unicode Italic** + - **Format as Unicode Bold Italic** -- Check if [someone already developed a plugin for what you want](https://obsidian.md/plugins)! There might be an existing plugin similar enough that you can partner up with. -- Make a copy of this repo as a template with the "Use this template" button (login to GitHub if you don't see it). -- Clone your repo to a local development folder. For convenience, you can place this folder in your `.obsidian/plugins/your-plugin-name` folder. -- Install NodeJS, then run `npm i` in the command line under your repo folder. -- Run `npm run dev` to compile your plugin from `main.ts` to `main.js`. -- Make changes to `main.ts` (or create new `.ts` files). Those changes should be automatically compiled into `main.js`. -- Reload Obsidian to load the new version of your plugin. -- Enable plugin in settings window. -- For updates to the Obsidian API run `npm update` in the command line under your repo folder. +The selected text is replaced in place with its Unicode equivalent. -## Releasing new releases +## Installation -- Update your `manifest.json` with your new version number, such as `1.0.1`, and the minimum Obsidian version required for your latest release. -- Update your `versions.json` file with `"new-plugin-version": "minimum-obsidian-version"` so older versions of Obsidian can download an older version of your plugin that's compatible. -- Create new GitHub release using your new version number as the "Tag version". Use the exact version number, don't include a prefix `v`. See here for an example: https://github.com/obsidianmd/obsidian-sample-plugin/releases -- Upload the files `manifest.json`, `main.js`, `styles.css` as binary attachments. Note: The manifest.json file must be in two places, first the root path of your repository and also in the release. -- Publish the release. +### Manual -> You can simplify the version bump process by running `npm version patch`, `npm version minor` or `npm version major` after updating `minAppVersion` manually in `manifest.json`. -> The command will bump version in `manifest.json` and `package.json`, and add the entry for the new version to `versions.json` +1. Build the plugin (see [Development](#development)) or download a release +2. Copy `main.js` and `manifest.json` to your vault at: + ``` + /.obsidian/plugins/unicode-text-formatter/ + ``` +3. In Obsidian: **Settings → Community Plugins → Installed Plugins** — enable **Unicode Text Formatter** -## Adding your plugin to the community plugin list +## Development -- Check the [plugin guidelines](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines). -- Publish an initial version. -- Make sure you have a `README.md` file in the root of your repo. -- Make a pull request at https://github.com/obsidianmd/obsidian-releases to add your plugin. +Requirements: Node.js ≥ 16 -## How to use - -- Clone this repo. -- Make sure your NodeJS is at least v16 (`node --version`). -- `npm i` or `yarn` to install dependencies. -- `npm run dev` to start compilation in watch mode. - -## Manually installing the plugin - -- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`. - -## Improve code quality with eslint -- [ESLint](https://eslint.org/) is a tool that analyzes your code to quickly find problems. You can run ESLint against your plugin to find common bugs and ways to improve your code. -- This project already has eslint preconfigured, you can invoke a check by running`npm run lint` -- Together with a custom eslint [plugin](https://github.com/obsidianmd/eslint-plugin) for Obsidan specific code guidelines. -- A GitHub action is preconfigured to automatically lint every commit on all branches. - -## Funding URL - -You can include funding URLs where people who use your plugin can financially support it. - -The simple way is to set the `fundingUrl` field to your link in your `manifest.json` file: - -```json -{ - "fundingUrl": "https://buymeacoffee.com" -} +```bash +npm install +npm run dev # watch mode — recompiles on save +npm run build # one-time production build +npm run lint # ESLint check ``` -If you have multiple URLs, you can also do: +### Project structure -```json -{ - "fundingUrl": { - "Buy Me a Coffee": "https://buymeacoffee.com", - "GitHub Sponsor": "https://github.com/sponsors", - "Patreon": "https://www.patreon.com/" - } -} -``` +| File | Purpose | +|------|---------| +| `src/unicode-maps.ts` | Builds character lookup maps from Unicode code point ranges | +| `src/formatter.ts` | `transformText(text, style)` — maps each character through the selected style map | +| `src/commands.ts` | Registers the three editor commands with the Obsidian plugin API | +| `src/main.ts` | Plugin entry point — calls `registerCommands` on load | + +### Unicode blocks used + +| Style | Uppercase | Lowercase | Digits | +|-------|-----------|-----------|--------| +| Sans-Serif Bold | U+1D5D4–U+1D5ED | U+1D5EE–U+1D607 | U+1D7EC–U+1D7F5 | +| Sans-Serif Italic | U+1D608–U+1D621 | U+1D622–U+1D63B | — | +| Sans-Serif Bold-Italic | U+1D63C–U+1D655 | U+1D656–U+1D66F | — | + +## Releasing + +1. Update `manifest.json` with the new version and minimum Obsidian version +2. Update `versions.json`: `"new-version": "min-obsidian-version"` +3. Create a GitHub release tagged with the exact version number +4. Attach `manifest.json` and `main.js` as release assets + +> You can bump the version automatically: +> ```bash +> npm version patch # or minor / major +> ``` ## API Documentation -See https://docs.obsidian.md +See