Skip to main content

Code style: black

TXT to HTML Converter

A conversion tool made for converting .txt and .md files to standard HTML.

The main purpose of this program is to create TIL (Today I learned) HTML files for blogging and personal purposes. A TIL can be pretty useful to anyone creating one as they can write down important things that they learned about and share it with others, or just keep it for themselves as something to reference. However, you can also use it as a simple .txt or .md to HTML converter. For setup look at the setup section in the CONTRIBUTING.md file.

Table of Contents

Features

  • Users can specify a file or folder containing md or txt files for HTML conversion.
  • A stylesheet is added by default to the generated files.
  • TOML file support.
  • Markdown Only Features:
    • Detecting and converting code blocks to HTML <code> tag.
    • Detecting and converting bold Markdown syntax to HTML <strong> tag.
    • Detecting and converting horizontal rule Markdown syntax to HTML <hr> tag.

Optional Arguments

Argument Purpose
-s, --stylesheet Changes the default CSS stylesheet provided for the generated files
-l, --lang Specifies language used when generating HTML files. If not used, the default will be en-CA
-c, --config Allows for multiple arguments to be used at once, without having to type it all into a CLI
-o, --output Specifies a different output directory for the generated HTML files, instead of the default TIL directory
-sb, --sidebar Currently in preview, but generates a table of contents for you based on the already provided sidebar.py file
-v, --version Displays program name and current versions
-h, --help Provides help on the CLI explaining arguments and shows an example of execution

Usage

Customizing the Stylesheet

python txt_to_html.py -s https://cdnjs.cloudflare.com/ajax/libs/tufte-css/1.8.0/tufte.min.css filename.txt or python txt_to_html.py --stylesheet https://cdnjs.cloudflare.com/ajax/libs/tufte-css/1.8.0/tufte.min.css filename.txt

Changing the output directory

python txt_to_html.py -o .\foldername filename.txt or python txt_to_html.py --output .\foldername filename.txt

Using a TOML config file

python txt_to_html.py -c filename.toml or python txt_to_html.py --config filename.toml

Generating a table of contents (sidebar)

python txt_to_html.py -sb sidebar.py filename.txt or python txt_to_html.py --sidebar sidebar.py filename.txt

Changing the lang attribute

python txt_to_html -l fr filename.txt or python txt_to_html --lang fr filename.txt

All the examples above can be used together on the CLI or in a TOML config file.

Checking the version of TXT to HTML Converter

python txt_to_html.py -v or python txt_to_html.py --version

Getting help for TXT to HTML Converter

python txt_to_html.py -h or python txt_to_html.py --help

Example output of the program can be found in the examples folder.

Release files for text-to-html-converter 1.0.2

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

Source distribution (sdist)

Source distribution for text-to-html-converter 1.0.2
File Size Uploaded
text_to_html_converter-1.0.2.tar.gz 126.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for text-to-html-converter 1.0.2
File Interpreter ABI Platform
text_to_html_converter-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 146.3 kB

Release files / text_to_html_converter-1.0.2.tar.gz

Download URL text_to_html_converter-1.0.2.tar.gz
Size 126.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fb4ba9f3ebd03eb917bc53d11f80a87ffe4ab88d23e1ccfc5dacf15225e1a49e
BLAKE2b-256 checksum
How to use checksums
9155035e661188b96c3dd3bac60dfb2e94ea14be90574e10e4d4067304fb5b71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / text_to_html_converter-1.0.2-py3-none-any.whl

Download URL text_to_html_converter-1.0.2-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ec5f4e4c07d521c905195907bb465cd64c2227ac99ad3ff6b4730b099ca1b97
BLAKE2b-256 checksum
How to use checksums
067c9c3727ec38e5da668549993270ead885c36b4b669d47853470d309311b99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

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