【MN Official Add-on】Ver4.1.1: OhMyMN, the MarginNote addon development framework, is also a toolbox that can process excerpts automatically

I’m so sorry OhMyMN is late. Now, OhMyMN v4.1.0 is released for all users of MarginNote, Including users outside of China. It has full English user interface and documentation. Starting with this version, OhMyMN will pay attention to the needs of English-speaking users. Welcom to give your suggestions here or on Github.

We need volunteers to improve the quality of translation of documents, Welcom!

Introduction

For Plugin/Addon Developer

MarginNote’s open API is rather low-level, which makes it difficult to get started and requires a lot of knowledge about Objective-C and iOS development.

What OhMyMN does is to simplify all this by translating all the APIs into TypeScript versions and encapsulates a lot of useful methods so that you can develop without having to touch the underlying APIs.

Secondly, OhMyMN provides a very good modular development framework, tying it to the control panel and profile management. You can’t develop a plugin as complex as OhMyMN without these things maybe.

Finally, OhMyMN is developed entirely in TypeScript, which, together with VS Code, enables code hinting, type checking, eliminates most problems at compile time, and makes it very easy to refactor features.

Currently the TypeScript version of the API has been released to NPM. With the release of OhMyMN v4.1.0, the API has basically been stabilized and the overall architecture of OhMyMN has been stabilized, so basically no major adjustments will be made. If a lot of people want to participate, I’ll add notes and documentation. But this part will not be my main work for now.

:ear: General users Please pay attention

Module: It is similar to plugins/addons, which are internal to OhMyMN.

OhMyMN is essentially a toolbox. All the functionalities inside are in separate modules, each of which is provided with three capabilities:

  1. When excerpting, modify the excerpted content or get the excerpted content and perform other operations.
  2. After selecting a card in the mindmap, make changes to the card or get information and perform other operations.
  3. After selecting text in a document, get the text or selection information and perform other operations.

Some modules may use all three capabilities, some may use only one of them, and some may use none of them with only a few options.

Modules that use the first capability usually start with Auto, such as AutoTitle and AutoDef, indicating that they can be executed automatically on excerpt (this is not by default though. You need to turn on Auto Run When Excerpting . Modules that use the first capability usually also use the second capability in order to handle cards that already exist.

The second and third capabilities are also often used together, for example, for copying, searching, and exporting. They have a common name - Action. The actions of all modules are in MagicAction for Card and MagicAction for Text. The button, when clicked, performs the corresponding action.

Apart from that, all modules are divided into two main categories.

  1. Required modules: Modules that cannot be disabled.
  1. Optional modules: You can select the modules to be enabled in the OhMyMN —— Module Quick Switch .
  • Shortcut: Use URL Scheme to trigger actions. You can set your own shortcut keys to open the URL Scheme.
  • Gesture: Use gestures to trigger actions.
  • CopySearch: Copy or search for selected text or selected cards.
  • AutoX
    • Another AutoTitle: Auto convert titles.
    • Another AutoDef: Auto split excerpts into two parts (title and excerpt) and extract the title.
    • AutoFormat: Auto format excerpts, such as automatically adding spaces.
    • AutoComplete: Auto complete English word forms, fill in word information, and make word cards.
    • AutoReplace: Auto replace the content in the excerpt.
    • AutoList: Auto break the line at the specified position and add the serial number.
    • AutoTag: Auto add tags or extract parts of the content as tags.
    • AutoComment: Auto add comments or extract parts of the content as comments.
    • AutoStyle: Auto set the excerpt color and fill style.
    • AutoOCR: Auto OCR recognition or correction of extracted selections.
    • AutoTranslate: Auto translate the excerpted content.
    • AutoSimplify: Auto convert from Traditional Chinese to Simplified Chinese.

Usage

User Guide: https://ohmymn.vercel.app/guide/
PDF version of User Guide: OhMyMN Documentation v4.1.1.pdf (12.2 MB)

OhMyMN is very free and powerful. The user guide only provides the most basic usage, you need to explore the usage techniques by yourself. Feel free to share your tips and tricks.

Points to Note

  1. The logic of using OhMyMN is different from any previous plugins, especially the modules that begin with “Auto”, which have truly achieved full automation. You need to set the conditions for execution and turn on Auto Run When Excerpting so that it can execute automatically when you need it. Modules often offer presets. You can choose to use the presets directly, or customize them. OhMyMN does not recommend indiscriminate executions, so there is no global switch to turn OhMyMN on or off with a single click.

  2. The priority of customization is always the highest in all module presets.

  3. If you are creating a notebook, you will need to re-enter after creation to let OhMyMN know about the document you just imported.

  4. OhMyMN can only handle excerpts. Anything you drag in from your browser or type in yourself is viewed as comments.

  5. Do not use OhMyMN and other plugins that execute automatically during excerpting simultaneously. Conflicts may occur.

  6. You need to press Enter to confirm the custom input, The prompt of saving successfully will appear and the input method editor will be closed. Otherwise, there is an input error.

  7. Deactivating OhMyMN in the plugin settings will clear the config . If an error causes a crash, you can disable and re-enable the plugin. Of course, in most cases, there is no need to clear the configuration since it will be very inconvenient to reset it.

  8. If you are highlighting content, MarginNote will reacquire the new excerpt content, which will nullify the OhMyMN processing. After highlighting content, you can re-process the excerpt by slightly modifying the excerpt selection.

  9. After highlighting content, two * s will appear on both sides of the highlighted content captured by OhMyMN, e.g. *This is the highlighted content** . Please pay extra attention when doing operations such as replacing, filtering, extracting, etc.

  10. If you can’t see the smiley logo after installing the plugin, you can try to re-install it. If it still does not work, then the system version is too low and you can upgrade the system.

  11. If you want the “Auto” modules to work together, you need to know the order of execution of the modules.

Download

MarginNote v3.7.21 Required
ohmymn_v4_1_1_signed.mnaddon (598.4 KB)

For users who can not use AutoComplete, there is also a version that includes the local database, please go to Github Release to download.

Source Code

marginnoteapp/ohmymn: MarginNote Addon Development Framework (github.com)

3 Likes

Thank you very much for the translation.

It’s a pretty complex plugin and challenging to understand how everything works, but I am trying my best.

A question: Is it possible to use OhmyMN to automatically color notes in the mindmap based on tags? Or the other way around, to automatically tag a note in the mindmap based on its color?

ı dont understand how to use aouto translate
do ı need to pay something ?
and there is no turkish version ?