Skip to main content

A command-line tool to convert .txt and .md files to .html format

Project description

tml - Text to HTML Converter

Overview

tml is a simple command-line tool that converts .txt and .md files into .html format. The tool automatically wraps paragraphs from the input .txt or .md file in <p>...</p> or h1, h2, h3 tags respectively in the resulting .html file.

Usage

By default, if no output directory is specified, the .html files will be saved inside the tml/examples directory.

Txt to HTML

To convert a .txt file to .html:

./main.py <path-to-txt-file>

To specify a different output directory:

./main.py <path-to-txt-file> --output <path-to-output-directory>

md to HTML

To convert a .md file to .html:

./main.py <path-to-md-file>

To specify a different output directory:

./main.py <path-to-md-file> --output <path-to-output-directory>

Command Options:

Options Description
--version or -v Display the tool's version.
path Specify the path to a .txt or .md file or a directory containing multiple .txt files. If a directory is provided, tml will recursively process all .txt or .md files within.
--output or -o Specify a custom output directory. The tool will create the directory if it does not exist.
--config or -c Specify a custom TOML based config file where all the above flags and their values can be passed instead of passing them through command line input which are ignored if passed along with this flag.

Features

  • 📄 Converts single or multiple .txt and .md files to .html.
  • 🖋 Automatic paragraph wrapping in <p>...</p> tags.
  • 🖋 Automatic heading wrapping in h1, h2 ,h3 based on number of # specified in the .md file.
  • 📁 Can output to a custom directory or default to tml/examples.
  • 🔄 Overwrites existing output directory content to ensure it contains only the most recent outputs.
  • 🎉 Extracts title from the text file if present. The title is identified as the first line followed by two blank lines.
  • 🔗 NEW! Validates and processes links for both TXT and MD formats, marking broken links distinctly.

Contributing

For information on contributing to tml, such as setting up the environment and development practices, please read CONTRIBUTING.md.

License

MIT

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

tml_mnajibi-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

tml_mnajibi-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tml_mnajibi-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.4

File hashes

Hashes for tml_mnajibi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 141da35e32d6c54b7d4145d9c588bbc2e0e1b809b2015ecc5f3f4d884bd09ff9
MD5 78cad2ecb2dcf392c101fb6b37c0bb58
BLAKE2b-256 d7be41869cea5a4850c58c07c8d94b486be6448c316e67d0bdf11dc632755152

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tml_mnajibi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.4

File hashes

Hashes for tml_mnajibi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27fc0c66eaa66363ff5fadb6ce357dff2e6a7fe23a581cd6fc3e99297beffe1f
MD5 86d61d0741960bc27d763c5ed71ba5dc
BLAKE2b-256 6ca63e9fc3fec8746ca3de0503640c36757f336f98eea0b5cf79e72a996e0ac8

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