Yank Note Review: A Hackable Markdown Editor That Runs Code

7月29日 Published inMarkdown Tools

Yank Note is an extensible Markdown editor available on all major desktop platforms. It can be run locally as a native application or accessed directly through a web browser. At its core is the Monaco editor—the same engine that powers VS Code—specifically optimized for the Markdown experience.

Key Features

Yank Note is far more than a basic notepad. It includes a suite of tools that bridge the gap between a standard text editor and a lightweight integrated development environment (IDE).

  • Familiar Editing Experience: Because it uses Monaco, you get the same keyboard shortcuts and command palette functionality you expect from VS Code.
  • Version History: The app allows you to navigate back through previous document states, making it easy to recover content that was accidentally deleted.
  • Code Execution: You can execute JavaScript, PHP, Node.js, Python, or Bash scripts directly within your code blocks.
  • Rich Embedding Support: Integrate PlantUML diagrams, Drawio charts, ECharts, Mermaid flowcharts, or even full Luckysheet spreadsheets directly into your notes.
  • AI Copilot: You can connect the editor to OpenAI to enable intelligent autocompletion features.
  • File Encryption: Files with the .c.md extension are automatically password-protected. Decryption is handled locally within the app or browser to ensure privacy.
  • Synchronized Scrolling: The editor and preview panes move in tandem, though the preview can be scrolled independently when necessary.
  • Direct Image Pasting: Paste screenshots directly from your clipboard. These can be saved as local image files or embedded as Base64 strings.
  • GitHub-Flavored Markdown: Tables, task lists, and footnotes render exactly as they would on GitHub.
  • Mind Map View: With a single toggle, you can transform nested bulleted lists into visual mind maps.
  • Document Interlinking: Create links to other local notes to navigate your knowledge base without leaving the interface.
  • PicGo Integration: Use PicGo to automatically upload images to remote servers or cloud storage providers.
  • Integrated Terminal: Run shell commands and navigate directories through a terminal window built directly into the editor.

A Note on Security

Yank Note prioritizes functionality over sandbox restrictions. Because plugins and code blocks have the authority to read files and execute system commands, security is a shared responsibility. You should treat Markdown files from untrusted sources with the same level of caution as an executable .exe file.

Additionally, if you use the built-in encryption, ensure you do not lose your password. There are no recovery backdoors; if a password is forgotten, brute-forcing the file is the only way to regain access.

Plugins: Customizing Your Editor

The architecture of Yank Note is centered on a robust plugin system. In fact, most core features—such as the terminal, graph renderers, and AI integration—are implemented as plugins. This means the same API used by the developers is fully available to you for customization.

Step-by-Step: Creating Your First Plugin

  1. Right-click the Yank Note tray icon and select "Open Home Directory."
  2. Navigate to the plugins folder and create a new file named plugin-hello.js.
  3. Insert the following code:
window.registerPlugin({
    name: 'plugin-hello',
    register: ctx => {
        ctx.statusBar.tapMenus(menus => {
            menus['plugin-hello'] = {
                id: 'plugin-hello',
                position: 'left',
                title: 'HELLO',
                onClick: () => {
                    ctx.ui.useToast().show('info', 'HELLO WORLD!');
                }
            }
        })
    }
});
  1. Right-click the tray icon and select "Development > Reload Page."
  2. You will now see a "HELLO" button in the status bar. Clicking it will trigger an info toast notification.

Core Concepts

The plugin system is driven by two primary mechanisms: Hooks and Actions.

  • Hooks: You can register handlers using ctx.registerHook and trigger them via ctx.triggerHook. Some internal hooks are "interruptible"—if a handler returns true, it stops subsequent handlers from executing. Common hooks include ACTION_BEFORE_RUN and VIEW_KEY_DOWN.
  • Actions: The ctx.action object manages named commands. You can find a full list of internal actions in the official API documentation.

Interacting with the Plugin API

The ctx object serves as your primary entry point for customization. To explore the modules and functions available to you, run the following snippet directly inside an editor code block:

// --run-- --no-worker--
console.log(Object.keys(ctx).join('\n'))

For quick modifications, you don’t even need to build a formal plugin. The code runner exposes ctx globally, allowing for one-liners like this:

// --run-- --no-worker--
ctx.ui.useToast().show("info", "HELLO WORLD!")

If you want to add a small interactive element to a specific note, you can embed an applet using HTML:

<!-- --applet-- -->
<button onclick="ctx.ui.useToast().show(`info`, `HELLO WORLD!`)">HELLO</button>

Sharing Your Work

If you develop a theme or plugin that could benefit the community, you can find documentation on how to distribute your extensions at [github.com/purocean/yank-note-extension](github.com/purocean/yank-note-extension#readme).

Yank Note is designed for users who want total control over their writing environment. It doesn't impose a specific workflow; instead, it provides the engine and the tools for you to build your own.