markdown2zim icon indicating copy to clipboard operation
markdown2zim copied to clipboard

Zim to Markdown link conversion mistake

Open techgique opened this issue 5 years ago • 0 comments

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.py and add #!/usr/bin/env python as 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 .txt files mixed within the Zim files
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 {} \;

techgique avatar Jul 23 '20 02:07 techgique