diff --git a/README.md b/README.md index d3e8ad5..24b4596 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Or you can consider to bind custom hotkeys to those commands according to [#29]( - [List](#list) - [Links](#links) - [Copy / OCR issues](#copy--ocr-issues) - - [Academic/Study](#academicstudy) + - [Academic / Study](#academic--study) - [Advanced custom](#advanced-custom) - [Others](#others) - [Support](#support) @@ -103,15 +103,15 @@ Or you can consider to bind custom hotkeys to those commands according to [#29]( | Replace **ligature** | Replace [ligature](https://en.wikipedia.org/wiki/Ligature_(writing)) to Non-ligature [#24](https://github.com/Benature/obsidian-text-format/issues/24) | -### Academic/Study +### Academic / Study -| Command | Description | -| ---------------------------------------------- | ---------------------------------------------------------------------------- | -| Convert selection into **Anki** card format | [#32](https://github.com/Benature/obsidian-text-format/pull/32) | -| Remove citation index | e.g., `A research [12] about notes` => `A research about notes` | -| Get **Zotero** note from clipboard and paste ⚙️ | See [below ⬇️](#zotero-format) | -| Convert single letter into **math** mode | e.g. convert `P` into `$P$` (latex), apply for all single letter except `a`. | -| Convert **Mathpix** array to markdown table | Convert latex array generated by Mathpix to markdown table format | +| Command | Description | +| ------------------------------------------------------ | ---------------------------------------------------------------------------- | +| Convert selection into **Anki** card format | [#32](https://github.com/Benature/obsidian-text-format/pull/32) | +| Remove citation index | e.g., `A research [12] about notes` => `A research about notes` | +| Get **Zotero** note from clipboard and paste ⚙️ | See [below ⬇️](#zotero-format) | +| Detect and convert characters to **math mode** (LaTeX) | e.g. convert `P` into `$P$` (latex), apply for all single letter except `a`. | +| Convert **Mathpix** array to markdown table | Convert latex array generated by Mathpix to markdown table format | diff --git a/docs/Examples.md b/docs/Examples.md index 86bf055..09015f0 100644 --- a/docs/Examples.md +++ b/docs/Examples.md @@ -151,8 +151,15 @@ When the settings are + 中文标点异常。比如是复制的文本,或者是 OCR 的结果。 ``` -... +# Academic / Study + +## Math mode +```diff +- Suppose variable x1 add x2 equals to variable Y. ++ Suppose variable $x_1$ add $x_2$ equals to variable $Y$. +... + > Note: The document is still under development. \ No newline at end of file diff --git a/main.ts b/main.ts index 6cd861e..a223c18 100644 --- a/main.ts +++ b/main.ts @@ -597,6 +597,7 @@ export default class TextFormat extends Plugin { } log(...args: any[]): void { + // TODO: add verbose log setting if (true) { console.log(...args); } @@ -664,7 +665,6 @@ export default class TextFormat extends Plugin { this.log("adjustRange", adjustRange) const selectedText = editor.getRange(adjustRange.from, adjustRange.to); this.log("selectedText", selectedText) - // let cursorOffset = 0; //: MODIFY SELECTION let replacedText: string; try { @@ -676,14 +676,11 @@ export default class TextFormat extends Plugin { if (adjustRange.from.line == adjustRange.to.line) { const headingRes = headingLevel(selectedText, context); replacedText = headingRes.text; - // cursorOffset = headingRes.offset; } else { replacedText = ""; - // cursorOffset = 0; selectedText.split("\n").forEach((line, index) => { const headingRes = headingLevel(line, context, true); replacedText += headingRes.text + "\n"; - // cursorOffset += headingRes.offset; }); replacedText = replacedText.slice(0, -1); // remove the last `\n` } diff --git a/manifest-beta.json b/manifest-beta.json index 0a36e88..c02aa35 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "obsidian-text-format", "name": "Text Format", - "version": "3.0.0-b4", + "version": "3.0.0-b5", "minAppVersion": "0.9.7", "description": "Format text such as lowercase/uppercase/capitalize/titlecase, converting order/bullet list, removing redundant spaces/newline characters.", "author": "Benature",