markdown2zim
markdown2zim copied to clipboard
Zim to Markdown link conversion mistake
This is sort of following on the comment about a known bug on another issue: https://github.com/Xunius/markdown2zim/issues/6#issuecomment-622404853
Upon converting a Zim file to Markdown, I was seeing links converted to http(s):*___ rather than http(s)://___.
I hope this can help others find the bug in the tool. In the meantime, here is what I did on Fedora 32 to convert all of my Zim files to Markdown and fix the bug in the link conversion.
- Edit
zim2markdown.pyand add#!/usr/bin/env pythonas the first line - Make the script executable with
chmod ug+x zim2markdown.py - Symlink the script to your user's local bin directory
ln -s /path/to/zim2markdown.py /home/(user)/.local/bin/ - Run the following commands from the root of the directory containing your Zim files
-
NOTE These commands assume there are not other
.txtfiles mixed within the Zim files
-
NOTE These commands assume there are not other
cd /path/to/directory/containing/only/zim/txt/files/
find . -iname '*.txt' -exec zim2markdown.py {} -o {}.md \;
find . -iname '*.md' -exec perl -p -i -e 's/(https?\:)\*/\1\/\//g' {} \;
find . -iname '*.txt' -exec rm {} \;
find . -type f -exec rename .txt.md .md {} \;