From 60b6073ca674c2ebfd0a39f1e6d93f9bac4b1f0a Mon Sep 17 00:00:00 2001 From: arne314 <73391160+arne314@users.noreply.github.com> Date: Sat, 2 Aug 2025 14:53:50 +0200 Subject: [PATCH] docs(draw): rnote usage and installation --- README.md | 21 +++++++++++++++------ lua/typstar/config.lua | 4 ++-- lua/typstar/drawings.lua | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5488179..82e3e5f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Typstar -Neovim plugin for efficient note taking in Typst +Neovim plugin for efficient (mathematical) note taking in Typst ## Features - Powerful autosnippets using [LuaSnip](https://github.com/L3MON4D3/LuaSnip/) and [Tree-sitter](https://tree-sitter.github.io/) (inspired by [fastex.nvim](https://github.com/lentilus/fastex.nvim)) -- Easy insertion of drawings using [Obsidian Excalidraw](https://github.com/zsviczian/obsidian-excalidraw-plugin) +- Easy insertion of drawings using [Obsidian Excalidraw](https://github.com/zsviczian/obsidian-excalidraw-plugin) or [Rnote](https://github.com/flxzt/rnote) - Export of [Anki](https://apps.ankiweb.net/) flashcards \[No Neovim required\] ## Usage @@ -32,9 +32,12 @@ Math snippets: Note that you can [customize](#custom-snippets) (enable, disable and modify) every snippet. -### Excalidraw -- Use `:TypstarInsertExcalidraw` to create a new drawing using the configured template, insert a figure displaying it and open it in Obsidian. -- To open an inserted drawing in Obsidian, simply run `:TypstarOpenExcalidraw` while your cursor is on a line referencing the drawing. +### Excalidraw/Rnote +- Use `:TypstarInsertExcalidraw`/`:TypstarInsertRnote` to + create a new drawing using the [configured](#configuration) template, + insert a figure displaying it and open it in Obsidian/Rnote. +- To open an inserted drawing in Obsidian/Rnote, + simply run `:TypstarOpenDrawing` while your cursor is on a line referencing the drawing. ### Anki Use the `flA` snippet to create a new flashcard @@ -156,7 +159,13 @@ require('typstar').setup({ -- depending on your neovim plugin system 1. Install [Obsidian](https://obsidian.md/) and create a vault in your typst note taking directory 2. Install the [obsidian-excalidraw-plugin](https://github.com/zsviczian/obsidian-excalidraw-plugin) and enable `Auto-export SVG` (in plugin settings at `Embedding Excalidraw into your Notes and Exporting > Export Settings > Auto-export Settings`) 3. Have the `xdg-open` command working or set a different command at `uriOpenCommand` in the [config](#configuration) -4. If you encounter issues try cloning the repo into `~/typstar` or setting the `typstarRoot` config accordingly, feel free to open an issue +4. If you encounter issues with the file creation of drawings, try cloning the repo into `~/typstar` or setting the `typstarRoot` config accordingly; feel free to open an issue + +### Rnote +1. Install [Rnote](https://github.com/flxzt/rnote?tab=readme-ov-file#installation); I recommend not using flatpak as that might cause issues with file permissions. +2. Make sure `rnote-cli` is available in your `PATH` or set a different command at `exportCommand` in the [config](#configuration) +3. Have the `xdg-open` command working with Rnote files or set a different command at `openCommand` in the [config](#configuration) +4. See comment 4 above at Excalidraw ### Anki 0. Typst version `0.12.0` or higher is required diff --git a/lua/typstar/config.lua b/lua/typstar/config.lua index c1380aa..d04d101 100644 --- a/lua/typstar/config.lua +++ b/lua/typstar/config.lua @@ -1,7 +1,7 @@ local M = {} local default_config = { - typstarRoot = nil, + typstarRoot = nil, -- typstar installation location required to use default drawing templates (usually determined automatically) anki = { typstarAnkiCmd = 'typstar-anki', typstCmd = 'typst', @@ -22,7 +22,7 @@ local default_config = { filename = 'drawing-%Y-%m-%d-%H-%M-%S', fileExtension = '.rnote', fileExtensionInserted = '.rnote.svg', -- valid rnote export type - uriOpenCommand = 'xdg-open', -- see comment above for excalidraw + openCommand = 'xdg-open', -- see comment above for excalidraw templatePath = {}, }, snippets = { diff --git a/lua/typstar/drawings.lua b/lua/typstar/drawings.lua index 05db403..701b303 100644 --- a/lua/typstar/drawings.lua +++ b/lua/typstar/drawings.lua @@ -42,7 +42,7 @@ end local function launch_rnote(path, path_inserted) print(string.format('Opening %s in Rnote', path)) - utils.run_shell_command(string.format('%s %s', config_rnote.uriOpenCommand, path), false) + utils.run_shell_command(string.format('%s %s', config_rnote.openCommand, path), false) auto_export_rnote(path, path_inserted) end