This Python script, convert.py, is designed to convert Safari bookmarks exported in HTML format into a neatly organized Markdown file. The script parses the HTML file, extracts bookmarks and their folder structure, and outputs them in Markdown format, maintaining the folder hierarchy.
- Python 3
- BeautifulSoup4
- Ensure Python 3 is installed on your system.
- Install BeautifulSoup4, if not already installed:
pip install beautifulsoup4
-
Export Bookmarks from Safari:
- In Safari, go to
File>Export Bookmarks...and save the HTML file.
- In Safari, go to
-
Run the Script:
- Execute the script in the terminal by navigating to the script's directory and running:
python convert.py [input_html_file] [output_markdown_file]
- Replace
[input_html_file]with the path to your exported HTML file (as a string). - Replace
[output_markdown_file]with the desired path for the Markdown output (as a string).
- Execute the script in the terminal by navigating to the script's directory and running:
- Ensure that the HTML file is exported correctly from Safari.
- If the script fails to run or produces unexpected output, check the HTML file format and ensure it matches the expected bookmark export format of Safari.
This script is released under the MIT License.