Skip to main content

Some markdown processing tools

Project description

Em-Md

tools for processing markdown files & projects with python & CLI

Features

  • Local Links Processor
    Rewrite Markdown links and embedded media paths in all markdown files in the directory specified with the --root option:
    • --mode to-absolute: convert relative links into root-absolute links (relative to your project root).
    • --mode to-relative: convert absolute links (that point to existing files within the project) back into relative paths.
    • Supports inline links/images, reference-style links, and HTML embeds (<img>, <a>, <video>, <audio>, <source>).
    • Skips code blocks and inline code to avoid accidental rewrites.
    • Flexible output: root-absolute (/path/file.md), file:/// URLs, or URLs with a base (e.g. https://example.com/...).
    • CLI with dry-run (--print-changes), in-place rewrite (--write), and automatic backups (--backup).

This is just the first tool — more Markdown utilities will be added to the Em-Md toolbox over time.

Quickstart

Install on local machine:

pip install em-md

Run the local links processor on your project:

em-md-change-links \
  --root . \
  --glob "**/*.md" \
  --mode to-absolute \
  --print-changes

Apply changes in place (with backups):

em-md-change-links \
  --root . \
  --glob "**/*.md" \
  --mode to-absolute \
  --write --backup

Convert absolute paths back to relative paths:

em-md-change-links \
  --root . \
  --glob "**/*.md" \
  --mode to-relative \
  --write

Documentation

DevOps

To get started using this repository's code, checkout the commands built into its Makefile by running:

make help

Roadmap

  • Extend local_links with smarter path handling for cross-project references.

  • Add more Markdown processing tools:

    • frontmatter manager
    • heading/link normalizer
    • link checker / validator
  • Provide em-md as an installable CLI entrypoint (pip install em-md).

  • Package docs with worked examples and best practices.

Contributing

Get Involved

  • GitHub Discussions: if you want to share ideas
  • GitHub Issues: if you find bugs, other issues, or would like to submit feature requests
  • GitHub Merge Requests: if you think you know what you're doing, you're very welcome!

Donations

To support me in my work on this and other projects, you can make donations with the following currencies:

Donations help me:

  • dedicate more time to developing and maintaining open-source projects
  • cover costs for IT infrastructure
  • finance projects requiring additional hardware & compute

About the Developer

This project is developed by a human one-man team, publishing under the name Emendir.
I build open technologies trying to improve our world; learning, working and sharing under the principle:

Freely I have received, freely I give.

Feel welcome to join in with code contributions, discussions, ideas and more!

Open-Source in the Public Domain

I dedicate this project to the public domain. It is open source and free to use, share, modify, and build upon without restrictions or conditions.

I make no patent or trademark claims over this project.

Formally, you may use this project under either the:

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

em_md-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

em_md-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: em_md-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for em_md-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b61419ce1f6917529c530476540e7c13bfe55aa0dce321f44d11c59b3247243
MD5 1757593e3ac4b793d58a907f23341c12
BLAKE2b-256 bc1f3891beec5eb7e663af4e0a40fadaa38c344eb32b3496720b0873367c6acf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: em_md-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for em_md-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 397b2a0934d7c6f12e83356a881e4de93758182ce6e379b13fcbc2d662083e42
MD5 065c3edf62e818e57bf88a96f3d564f9
BLAKE2b-256 d2faf23cab5caa386820ec330e69e6e51d0ab9915862595552d16c3617767e04

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