Convert a copy of the Obsidian folder from markdown to HTML (see example script)
Import the HTML files in Notes.app
Known issues
The tags with a slash are not recognised by Notes.app. You can remove these lines or replace the slash (/) with a double hyphen (--). Do this in the markdown files before conversion .
I intend to remove all default tags and add a #JDex tag to be able to create a Smart Folder to create a flat list of all index files.
I have found a few quirks in the converted HTML file. For example, the table in 15.50 is not perfect. I have not spent any time to fix this with pandoc, but you might tune or tweak it yourself. I myself will fix this manually in Notes.
The converted HTML files are all in one folder. If you want to have these in subfolders for areas and categories, you should manually create the folder structure (or also copy it from the pack) and move the files in the appropriate folder before you import. When importing, Notes.app will provide you the option to ‘preserve folder structure’, which you should do.
Example script
A sample bash conversion script (thank you, ChatGPT) might look like this (only run this at your own risk if you understand it).
You should only need to specify the location of the Obsidian folder of the Life Admin Pack in SOURCE_DIR.
jdex2notes.sh
#!/bin/bash
# Check if pandoc is installed
if ! command -v pandoc &> /dev/null
then
echo "Pandoc is not installed. Please install it and try again."
exit 1
fi
# Directory containing the source files to be copied
SOURCE_DIR="source_files"
# Get the list of source Markdown files
SOURCE_FILES=("$SOURCE_DIR"/*.md)
# Get the user's Desktop path
DESKTOP_DIR="$HOME/Desktop"
# Directory where the Markdown files are located
INPUT_DIR="$DESKTOP_DIR/markdown_files"
# Directory where the HTML files should be saved
OUTPUT_DIR="$DESKTOP_DIR/html_files"
# Create the input directory if it doesn't exist
if [ ! -d "$INPUT_DIR" ]; then
mkdir -p "$INPUT_DIR"
fi
# Create the output directory if it doesn't exist
if [ ! -d "$OUTPUT_DIR" ]; then
mkdir -p "$OUTPUT_DIR"
fi
# Clean the output directory by removing any existing files
rm -f "$OUTPUT_DIR"/*.html
echo "HTML output directory has been cleaned."
# Copy the Markdown files from the source directory to the input directory
cp "${SOURCE_FILES[@]}" "$INPUT_DIR"
# Check if there are any Markdown files in the input directory
if [ ${#SOURCE_FILES[@]} -eq 0 ]; then
echo "No Markdown files found in $SOURCE_DIR."
exit 1
fi
# Loop through each .md file in the input directory
for md_file in "$INPUT_DIR"/*.md; do
# Get the filename without the extension
filename=$(basename "$md_file" .md)
# Convert the .md file to .html
pandoc "$md_file" -o "$OUTPUT_DIR/$filename.html"
echo "$md_file has been converted to $OUTPUT_DIR/$filename.html"
done
# Delete the copied Markdown files from the input directory
rm "$INPUT_DIR"/*.md
echo "Copied Markdown files have been deleted from $INPUT_DIR."
echo "All files have been copied, converted, and cleaned up."
I’ve tried importing again myself and found that the Markdown document needs to have a # (H1) title. Obsidian shows the filename, but Apple just uses the first line (usually that header) as the document name.
I ran a few tests and found that I could run this BASH shell script to take the Obsidian filename and edit the Markdown file to add the ‘title’ or “#” header using the filename string as the title.
Once I ran the script, I was able to import the Markdown files into Apple Notes without issue. They also were imported with the folder structure intact.
The script performs the following:
Processes .md and .MD files.
Uses the filename without its extension.
Skips files that already begin with the same # Title line.
Makes a .bak backup next to every changed file.
Handles spaces and special characters in filenames safely.
Recurses into subfolders.
If you do not want to create the .bak files, you can commend out the line by adding a # in front of it:
cp -p “$file” “$file.bak”
would become:
#cp -p “$file” “$file.bak”
This script would take a file named:
Project Status Update.md
with contents:
This is the current project status.
- Item one
- Item two
and it would become:
# Project Status Update
This is the current project status.
- Item one
- Item two
The BASH shell script is:
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -ne 1 ]]; then
echo "Usage: $(basename "$0") /path/to/markdown-folder"
exit 1
fi
TARGET_FOLDER="$1"
if [[ ! -d "$TARGET_FOLDER" ]]; then
echo "Error: Not a folder: $TARGET_FOLDER"
exit 1
fi
find "$TARGET_FOLDER" -type f \( -iname '*.md' \) -print0 |
while IFS= read -r -d '' file; do
filename="$(basename "$file")"
title="${filename%.*}"
heading="# $title"
first_line="$(head -n 1 "$file" || true)"
if [[ "$first_line" == "$heading" ]]; then
echo "Skipped (already titled): $file"
continue
fi
cp -p "$file" "$file.bak"
temp_file="$(mktemp "${file}.tmp.XXXXXX")"
{
printf '%s\n\n' "$heading"
cat "$file"
} > "$temp_file"
mv "$temp_file" "$file"
echo "Updated: $file"
done
echo "Done. Backup copies have the .bak extension."
Here is a screenshot of what my Apple Notes looks like after running the script. Apple Notes will prompt you that it will create a new “Imported Notes” folder. I plan on moving all of the imported Notes into another area of Apple Notes but wanted to show you what it looks like before I made any changes.
Last time I tried this was when the pack was released. I tried really hard for days to get the import working and it just always looked like total crap. There was no formatting for headers, for example.
I’d love to properly support Apple Notes. I’ll take a look at this in the next few weeks. Thanks for posting it.