Skip to content

Repository files navigation

mdtk (Markdown Toolkit)

Tools for working with markdown files.

PyPI versionCIDocumentationLicense: MIT

Installation

pip install mdtk

Requires Python 3.10+.

Usage

Chrome bookmarks to markdown

  1. In Chrome, open the bookmark manager (chrome://bookmarks), put the links you want to export into one folder, and use Export bookmarks to save an HTML file.
  2. Convert that folder to a markdown link list:
mdtk-bookmarks bookmarks.html links.md --folder "Reading List"
$ cat links.md- [GitHub - Where the world builds software](https://github.com)- [Welcome to Python.org](https://python.org)

Options:

  • --folder NAME - the bookmark folder to extract (default: EXPORT_FOLDER)
  • --version - print the mdtk version and exit

Behavior notes:

  • Bookmarks inside nested subfolders are included, flattened in document order.
  • If several folders share the same name, the first one in the file is used.
  • Titles and URLs are escaped so the generated markdown links stay valid.
  • If the folder is not found, the error message lists the folders the export does contain.

Python API

frommdtkimportBookmarkError, convert_bookmarkscount=convert_bookmarks("bookmarks.html", "links.md", folder_name="Reading List")
print(f"exported {count} bookmarks")

convert_bookmarks returns the number of bookmarks written and raises BookmarkError for anything that goes wrong (missing file, unknown folder, input that is not a bookmarks export, ...).

Development

git clone https://github.com/tommcd/mdtk.git
cd mdtk
pip install -e ".[dev]"
pytest # run the tests
ruff check .# lint
ruff format --check .# formatting
tox # everything, on all supported Python versions

Links

License

MIT

About

Markdown Toolkit - Tools for working with markdown files

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages