Skip to main content

Converts Supernote exports to markdown

Project description

Supernote to Markdown converter (sn2md)

sn2md is a command-line tool to convert Supernote .note files into markdown. It leverages OpenAI GPT-4o to convert images and text from Supernote files into a structured markdown document.

Features

  • Converts Supernote .note files to markdown.
  • Supports conversion of images to markdown using the Mermaid diagramming tool.
  • Automatically handles math equations using $ and $$ style math blocks.
  • Generates a markdown file with metadata and embedded images.

Installation

pip install sn2md

Setup your OPENAI_API_KEY environment variable.

Development

git clone https://github.com/yourusername/supernote-importer.git
cd supernote-importer
poetry install

Usage

To import a single Supernote .note file, use the file command:

# import one .note file:
sn2md file <path_to_note_file> --output <output_directory>

# import a directory of .note files:
sn2md directory <path_to_directory> --output <output_directory>

Notes:

  • A cache file is also generated, so repeated runs don't recreate the same data. You can force a refresh by running with the --force flag.

Custom Templates

You can provide your own jinja template, if you prefer to customize the markdown output. The default template is:

---
created: {{year_month_day}}
tags: supernote
---

{{markdown}}

# Images
{% for image in images %}
- ![{{ image.name }}]({{image.name}})
{% endfor %}

Variables supplied to the template:

  • year_month_day: The date the note was created (eg, 2024-05-12).
  • markdown: The markdown content of the note.
  • images: an array of image objects with the following properties:
    • name: The name of the image file.
    • rel_path: The relative path to the image file to where the file was run from.
    • abs_path: The absolute path to the image file.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

  • Supernote for their amazing note-taking devices.
  • LangChain for providing the core libraries used in this project.
  • OpenAI for the GPT-4 model.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sn2md-0.1.0.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sn2md-0.1.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file sn2md-0.1.0.tar.gz.

File metadata

  • Download URL: sn2md-0.1.0.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0

File hashes

Hashes for sn2md-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3747691cdcd2eb790e108ec604886483b28b1f3708d4cddc162258ae5a768e29
MD5 030d65abbacca2c7dc44f8756703d042
BLAKE2b-256 d3ef4c87a650af4308678d77b474a381fa7203e102655aa4aa293122d931424d

See more details on using hashes here.

File details

Details for the file sn2md-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sn2md-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0

File hashes

Hashes for sn2md-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b1354db0576f7f3610fc1789a109cd69e50ab2cb6b1bbd6a9ee6aaa733b6e832
MD5 4e0eb4df67de0c79291ba02a2afde09a
BLAKE2b-256 f1eab4608092eae00e3dd45bd831adab7e074fd63b42d9db19fbac1fbbc8365d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page