This script uses Pandoc!
Make sure you have thepandoc.exe
binary available in your %PATH%
Fluff
I like Zim. It is the first note-taking application where I finally gained the habit of writing and managing my technical and personal notes in a more or less organized way. There are, however, a number of major flaws in Zim when I compare it with other fancier note-taking tools like Obsidian, OneNote, etc. The number one flaw, to me, is the inability to paste formatted text from other apps and preserve some of their formatting (bold, italic, hyperlinks, • Bullet lists, headings,code snippets
, etc.).
Luckily, Pandoc supports Zim's peculiar wiki syntax as an output format and Windows' PowerShell has a Get-Clipboard
cmdlet with the ability to retrieve the clipboard content in HTML format.
This is where this script comes in handy:
Download and extract the html-to-zim.ps1
file. Then, inside Zim:
- On the menu bar, click Tools → Custom Tools
- Click the
[+]
button on the right - Fill in the "Edit Custom Tool" form like this:
Edit Custom Tool | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
it's a bit easier. The command can be this one-liner:
sh -c "xclip -selection CLIPBOARD -target text/html -out | pandoc --from html --to zim"
No script needed! (although it's technically possible to make a PowerShell one-liner from the html-to-zim.ps1 script)
Maybe go pick your favourite icon theme's internet-web-browser.svg
file for flavour.
- Open the Preferences window (Edit → Preferences)
- Go to the Key bindings tab
- There is an action for the Custom Tool you just created.
It's probably the 2nd or 3rd one in the list and the name looks like
<Actions>/custom_tools/paste from html-usercreated
- Double click the Key Binding cell (it probably says "Disabled")
- Press Ctrl+Shift+V
- Click OK
Now test this new Custom Tool: Copy some formatted text from Word or the web, then jump back to Zim and try pasting it with either Tools → Paste from HTML or Ctrl+Shift+V.
The clipboard was converted to Zim's wiki syntax and inserted in the cursor's position!
Now press Ctrl+R for Zim to redisplay it as formatted text.
Happy Zimming!