Skip to content

Instantly share code, notes, and snippets.

@romilly
Created October 20, 2021 05:12
Show Gist options
  • Save romilly/8b3a747e7aca4c07eec113d9c3018ac2 to your computer and use it in GitHub Desktop.
Save romilly/8b3a747e7aca4c07eec113d9c3018ac2 to your computer and use it in GitHub Desktop.
import xml.etree.ElementTree as ET
import html2text
def convert(enex_file_name: str, markdown_file_name: str) -> None:
enex = ET.parse(enex_file_name)
root = enex.getroot()
note = root.find('note')
html = note.find('content').text
text = html2text.html2text(html)
with open(markdown_file_name, 'w') as md:
md.write(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment