I have been using notions for over a year. I have only been using the basic functions of notions. With recent updates from Apple Notes, I am experimenting the possibilities of replacing notion with Apple Notes.
I am having trouble exporting everything that I have from notion to Apple note. I exported my notes in markdown format and than try to imports them into Apple notes. However it is shown as all marked down.
Tried searching on the internet, apparently there is no straightforward way to achieve it.
Hence I have written a simple python script to convert all markdown into HTML that Apple Notes likes.
import zipfile
import os
import markdown
import shutil
def convert_markdown_to_html(zip_input_path, zip_output_path):
# Create a temporary directory to store the HTML files and images
temp_dir = 'temp_html_files'
os.makedirs(temp_dir, exist_ok=True)
with zipfile.ZipFile(zip_input_path, 'r') as zip_ref:
# Extract all the contents into the temporary directory
zip_ref.extractall(temp_dir)
# Prepare to create a new zip file for the HTML files and images
with zipfile.ZipFile(zip_output_path, 'w', zipfile.ZIP_DEFLATED) as zip_out:
for foldername, subfolders, filenames in os.walk(temp_dir):
for filename in filenames:
file_path = os.path.join(foldername, filename)
relative_path = os.path.relpath(file_path, temp_dir)
if filename.endswith('.md'):
# Read the Markdown file
with open(file_path, 'r') as md_file:
md_content = md_file.read()
# Convert Markdown to HTML
html_content = markdown.markdown(md_content)
# Write the HTML content to a new file
html_filename = filename[:-3] + '.html'
html_filepath = os.path.join(foldername, html_filename)
with open(html_filepath, 'w') as html_file:
html_file.write(html_content)
# Add the HTML file to the output zip file
zip_out.write(html_filepath, os.path.join(os.path.dirname(relative_path), html_filename))
elif any(filename.lower().endswith(ext) for ext in ['.png', '.jpg', '.jpeg', '.gif', '.bmp']):
# Add image files to the output zip file
zip_out.write(file_path, relative_path)
# Clean up the temporary directory
shutil.rmtree(temp_dir)
# Example usage
convert_markdown_to_html('notion01.zip', 'notion01_html.zip')
The above scripts will port your images into apple notes as well.
You will need to have python 3.xx install and simply replace the zip file names as you like. Run the program and you will get a zip file of HTML that Apple Notes can take in.