Crates.io | obsidian2neorg |
lib.rs | obsidian2neorg |
version | 0.1.1 |
source | src |
created_at | 2023-10-29 17:18:02.818376 |
updated_at | 2023-10-29 18:33:22.97335 |
description | Transform obsidian markdown into neorg |
homepage | https://github.com/jonboh/obsidian2neorg |
repository | https://github.com/jonboh/obsidian2neorg |
max_upload_size | |
id | 1017634 |
size | 24,235 |
Transform from Obsidian Markdown to Neorg format.
obsidian2neorg
takes input from stdin
and outputs the transformation to stdout
.
You can transform a file like this:
cat file.md | obsidian2neorg > file.norg
You'll need to have rustup installed. Then install with Cargo
cargo install obsidian2neorg
You can find in this repository a shell script that will transform all .md
files
in a folder and copy all other files. I've used this script to port all my notes to
Neorg using obsidian2neorg.
folder_path="vault"
out_path="vault_neorg"
mkdir -p $out_path
find "$folder_path" -type f -not -path "*/.git/*" -not -name "*.md" | while read -r file; do
relative_path="${file#$folder_path/}"
out_file="${out_path}/${relative_path}"
mkdir -p "$(dirname "$out_file")"
cp "$file" "$out_file"
done
find "$folder_path" -type f -not -path "*/.git/*" -name "*.md" | while read -r file; do
lowercase_filename=$(basename "$file" | tr '[:upper:]' '[:lower:]')
final_filename=${lowercase_filename// /-}
relative_path="${final_filename#$folder_path/}"
out_file="${out_path}/${relative_path%.md}.norg"
mkdir -p "$(dirname "$out_file")"
cat "$file" | obsidian2neorg > "$out_file"
done
The transformations are based on regex, and not every possible Markdown style is implemented, but it should be enough to get your notes in an acceptable state to start working on Neorg.
By default file links are forced into lowercase-without-spaces
form. This makes it easy to rename all
files so that relations are easily transferred.
If you want to keep them as they are pass the --literal-links
flag:
obsidian2neorg --literal-links
In this case you'll need to modify the bulk transformation script to avoid the renaming
folder_path="vault" # change this to the location of your vault/notes folder
out_path="vault_neorg" # this will be the output folder
mkdir -p $out_path
find "$folder_path" -type f -not -path "*/.git/*" -not -name "*.md" | while read -r file; do
relative_path="${file#$folder_path/}"
out_file="${out_path}/${relative_path}"
mkdir -p "$(dirname "$out_file")"
cp "$file" "$out_file"
done
find "$folder_path" -type f -not -path "*/.git/*" -name "*.md" | while read -r file; do
relative_path="${file#$folder_path/}"
out_file="${out_path}/${relative_path%.md}.norg"
mkdir -p "$(dirname "$out_file")"
cat "$file" | obsidian2neorg > "$out_file"
done