3 0
Contact Author Sign in to rate

text editor for Latex, the selection or html source (FORK)

0.02MB. Updated 2020-07-26.
The author has shared 74 other item(s).

Description

This is a fork of the add-on External Editor. I use the version from 2020-03-06 which works great in linux for me but I besides editing the html source I also wanted to just send the selection to an external editor as plain text. The default shortcut to save back the edited text into Anki is "Ctrl+Shift+F6", to just send the text it's "Ctrl+F6". You can adjust these in the add-on config. If you don't need my additions you should use the original version of the add-on. My add-on has more code and more code means a higher chance to run into a bug. You must probably adjust the config for your computer and adjust the path of the editor and command line arguments needed. How you do this depends on your operating system. When I use the option to re-insert the content of the temporary file back into the anki editor it's exactly at the same position. So if you had some prior formatting the reinserted text will have it applied, too. If your selected text contained closing tags these will have been removed. Example: You have <​b>Hallo<​/b>World. You select "lo Wor" and edit it to "TEST" then afterwards you'll have <​b>HalTESTld which is invalid html because there's no closing b tag. In my Anki 2.1.28 Anki automatically adds a closing b tag. So don't mindlessly use this add-on on all kinds of selections. This could be useful if you are editing latex or have one of the markdown add-ons. You can also just send the text without ever getting it back into the Anki editor (default shortcut "Ctrl+F6") Some of my cards have code snippets. Sometimes I want to tweak them and run modified versions. And maybe I'll make cards with code that needs to be fixed or completed in the future. So far I copied this code and manually opened my text editor with a new/temporary file and then pasted my selection. # Limitations I don't have a Mac so this add-on was not tested on MacOS. So you'll probably run into an error on MacOS that I can't fix. Code contributions are welcome. Use it at your own risk.

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

1184418999

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons Contact Author

Reviews

on 1599790061
I'm running a problem when using Ctrl+Shift+X, that sends the content of the field to VSCode. When there is an image which name has spaces or special characters, when I save in VSCode, the file name is corrupted when it returns to Anki (spaces turn into %25, for example, and Anki doesn't recognize it). Is there a way of preventing this?
Comment from author
Hhmmm, at the moment I can't reproduce this problem on my computer: I tried with spaces, apostrophes, and an acute accent.

I suggest we continue this discussion either at https://forums.ankiweb.net/t/selection-to-external-text-editor-external-editor-fork-official-thread/1239 or at https://github.com/ijgnd/anki__external_latex_editor/issues.

Could you post this: From the main window click on Help->About. In the window that opens click the "Copy Debug Info" button and share the copied text. Could you also share the html source code of a field that isn't handled properly by my add-on: to get the source code disable my add-on, restart anki and then use "ctrl+shift+x".

Also try out the original add-on "External Editor" from https://ankiweb.net/shared/info/16727059. Does it work properly with this add-on? (note: you can't have both add-ons active at the same time). If you only care about editing the html source code I would use the original add-on.
on 1596466929
More detailed instructions on how to set up a custom text editor would be greatly appreciated. I managed to use only one of the two shortcuts (Ctrl+Shift+F6) by changing the line
"editor blocking": "code",
to
"editor blocking": "/usr/bin/subl",
which opens the selected text in Sublime Text 3 for Debian Buster and saves changes back to anki. Computer illiterate people like me need more hand-holding.
The addon is great though.
on 1595805468
Nice iteration, great screencast.