Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capacities-to-textbundle

Converts a Capacities notes export (Markdown + images) into TextBundle files suitable for import into Craft on macOS.

Background

Capacities exports notes as a folder of .md files organised by type, with associated images in a Media/ subfolder. Craft imports .textbundle packages — a folder format that bundles a Markdown file together with its assets and metadata. This script bridges the two.

Features

  • Recursively converts all .md files in the input directory, preserving the subfolder hierarchy in the output
  • Copies referenced images into each bundle's assets/ folder and rewrites paths accordingly
  • Sanitizes image filenames (removes spaces and parentheses) to maximise compatibility
  • Sets alt text to the image filename, matching Craft's own export format
  • Strips YAML front matter; prepends # Title from the title field and Tags: #tag1 #tag2 from the tags field
  • Removes the duplicate H1 heading that Capacities includes in the body
  • Converts Capacities multiline inline code (single backticks spanning multiple lines) to proper fenced code blocks
  • Escapes hashtags that appear at the start of a line in the body (would otherwise be parsed as headings)
  • Weblink notes (type: Weblink): renders as a titled markdown link, with any body notes preserved below
  • Task notes (type: Task): collected from all source files into a single Tasks.textbundle in the output root, with - [ ] / - [x] checkboxes based on completion status
  • Skips image-container notes (type: Image in front matter) and removes links to them
  • Handles URL-encoded paths, case-insensitive filename matching, and asset filename collisions
  • Ignores remote image URLs (leaves them unchanged)
  • Prints a summary report with warning details after each run

Requirements

Python 3.10+ — stdlib only, no dependencies.

Usage

python convert_to_textbundle.py [input_dir] [output_dir]
Argument Default Description
input_dir . (current directory) Root folder of your Capacities export
output_dir output/ Destination for generated .textbundle files

Example

python convert_to_textbundle.py "Capacities Export" "Capacities Output"

Output structure

Capacities Output/
  Tasks.textbundle/       ← all Task notes collected here
    text.markdown
    info.json
  Charts/
    My Chart.textbundle/
      text.markdown
      info.json
      assets/
        image_1.png
  Pages/
    My Page.textbundle/
      ...
  Weblinks/
    My Link.textbundle/
      text.markdown
      info.json

Importing into Craft

  1. Run the script and copy the output folder to a location accessible from your Mac (e.g. Google Drive)
  2. In Craft, use Import and select the output folder
  3. Craft will recreate the folder hierarchy and resolve all images automatically

About

Converts a capacities.io export folder to TextBundle files which can be imported by Craft (MacOS). Images are retained.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages