Post-process Zim Markdown export for use with Obsidian.
Loops through all subdirectories of a Zim notebook Markdown export.
- Renames pages according to the names given by the top first level heading.
- Removes each note's first line.
- Converts Markdown links to wikilinks (optional).
- Converts several Markdown formattings to Obsidian style:
- Replaces Setext-style headers with Atx-style headers.
- Converts horizontal rulers.
- Converts highlighting.
- Converts checkboxes.
- Converts tags.
- Converts verbatim blocks to "fenced" code blocks.
- A Python installation (version 3.9 or newer).
Save the file zim2obsidian.py.
- If you use indentiation in your Zim notebook, consider running the subst_indent.py tool first.
- Have Zim export the notebook to Markdown (export each page to a separate file).
- Make sure the Markdown files have the ".md" extension. If not, run the markdown2md.py tool first.
- If you have substituted indentiation with the subst_indent.py preprocessor, run the indent_md.py tool now.
- Copy zim2obsidian.py into the export root directory.
- Start it by double clicking on it or from the console.
usage: zim2obsidian.py [-h] [-b] [-w] [-@] [--no_rename dir1 dir2 ...]
Post-process Zim Markdown export for use with Obsidian
options:
-h, --help show this help message and exit
-b, --backticks verbatim blocks and inline code are marked with backticks
-w, --wikilinks Convert internal Markdown links to wikilinks
-@, --preserve_at Do not convert Zim tags to Obsidian tags
--no_rename Skip rename for specified directories (e.g. Journal)
Zim exports "verbatim" blocks indented with tabs. By default, zim2obsidian.py encloses such blocks with three backticks, so that Obsidian recognizes them as code blocks. Inline code markup is not supported by regular Zim.
However, you can enclose inline code with backticks in Zim, and
"fence" code blocks with three backticks, as usual in GitHub flavored markdown.
Then you can call zim2obsidian.py with the --backticks argument.
The script then keeps the backticks-enclosed passages verbatim.
Leading tabs are passed through without adding code block markers.
Pages generated by Zim's Journal plugin do not follow the same template, and their first headers (long form dates) are always different from the file names, which may not be desirable.
If you do not want rename certain directories like the Journal, you can
specify them in a space-delimited list like --no_rename Journal Journal2 ....
Note that this ONLY skips the rename. All the other processing like fixing
links will still be done.
Be aware, this is open source software, and you can implement your own features either locally after downloading and unpacking the latest release, or in your own fork.
You also can go to the "discussions" forum to discuss your idea.
Published under the MIT License