Skip to main content

txt2md-cli

PyPI version Python 3.8+ License: MIT GitHub

Convert plain text files to Markdown with automatic heading, list, and code detection — one command, no config.


The Problem

You have a .txt file full of notes, documentation, or exported content and want to quickly turn it into clean Markdown without manually adding #, -, or backticks everywhere. txt2md does this heuristically with zero configuration.


Installation

pip install txt2md-cli

Requires Python 3.8+. No external dependencies — only Python stdlib.


Usage

CLI

txt2md input.txt output.md

Python API

from txt2md_cli import convert_file, line_to_md

# Convert a full file
convert_file("notes.txt", "notes.md")

# Convert a single line
print(line_to_md("INTRODUCTION"))      # → # Introduction
print(line_to_md("- item one"))        # → - item one
print(line_to_md("some/path/file"))    # → `some/path/file`
print(line_to_md("Normal sentence."))  # → Normal sentence.

Detection Rules

Applied in order to each line:

Rule Condition Output
Heading ALL-CAPS, ≤60 chars, no period # Title Case
Bullet list Starts with - or * Preserved as-is
Numbered list Starts with 1., 2., etc. Preserved as-is
Inline code >10 chars, <2 spaces `text`
Paragraph Everything else Plain text

Example

Input (notes.txt):

INTRODUCTION

This is a normal paragraph with some text.

- First item
- Second item

1. Step one
2. Step two

/usr/local/bin/python3

CONCLUSION

Output (notes.md):

# Introduction

This is a normal paragraph with some text.

- First item
- Second item

1. Step one
2. Step two

`/usr/local/bin/python3`

# Conclusion

License

MIT © Santt997

Metadata

Release files for txt2md-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for txt2md-cli 0.1.0
File Size Uploaded Provenance
txt2md_cli-0.1.0.tar.gz 5.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for txt2md-cli 0.1.0
File Interpreter ABI Platform
txt2md_cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / txt2md_cli-0.1.0.tar.gz

Download URL txt2md_cli-0.1.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ae6ec361f71080917ee278b7dc3b458d5210109d330cf94c430bc8b81a1efec1
BLAKE2b-256 checksum
How to use checksums
23e5ca2fa932d590307a0c0cf5a6e10b5e435f914eeca74dce943ac6c30d43e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / txt2md_cli-0.1.0-py3-none-any.whl

Download URL txt2md_cli-0.1.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f15a0546adb2b73eefe1835ab3b272f28b3b378329281064dc938a133569c2a4
BLAKE2b-256 checksum
How to use checksums
3065be4e05b72414b6635eb00e5cc860dc01b0106ef682d6b0d69a7a486f6236
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for txt2md-cli 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page