Skip to main content

yamper

yamper is a simple Markdown to HTML converter/compiler. It allows users to easily convert Markdown files to HTML, with options for different templates and token output.

🌟 Features

Available Features

  • Headers
  • Paragraphs
  • Bold, Italic and strikethrough text
  • Links
  • Images
  • Unordered lists
  • Ordered lists
  • Blockquotes
  • Code blocks
  • Inline code
  • Horizontal rules
  • GitHub emojis 😉

🚧 Features in Development

  • Tables
  • Alerts
  • Footnotes
  • Nested lists
  • Nested quotes

📦 Installation

You can install yamper using pip:

pip install yamper

💻 Usage

Command Line Interface

yamper provides a command-line interface for easy conversion of Markdown files to HTML.

Basic usage:

yamper path/to/your/markdown_file.md

Options:

  • --out: Specify the output file name
  • -t, --template: Choose a template (options: "standard-light", "standard-dark", "plain")
  • --tokens: Output tokens instead of HTML

Examples:

# Convert to HTML with default template
yamper ../path/input.md --out output.html

# Convert to HTML with dark template
yamper ../path/input.md --out output.html -t standard-dark

# Output tokens
yamper ../path/input.md --tokens --out tokens.txt

🔧 Using yamper in Your Python Projects

You can also use yamper in your Python projects by importing its functions:

from yamper import to_html, to_tokens

# Convert Markdown to HTML and output to a new file
to_html('path/to/your/markdown_file.md', 'output.html', 'standard-dark')
or 
# Directly print the HTML content
html_content= to_html('path/to/your/markdown_file.md')
print(html_content)

# Get tokens from Markdown and output to a new file
tokens = to_tokens('path/to/your/markdown_file.md', 'tokens.txt')
or
# Directly print the tokens
to_tokens('path/to/your/markdown_file.md', 'tokens.txt')
print(tokens)

🎨 Templates

yamper currently offers three templates:

  1. standard-light (default): A light theme with built-in styles and code highlighting using Prism.js
  2. standard-dark: A dark theme with built-in styles and code highlighting using Prism.js
  3. plain: A basic HTML output without any additional styling or code highlighting

⚙️ API Reference

to_html(md_file, output_file=None, template="standard-light")

Converts a Markdown file to HTML.

  • md_file: Path to the input Markdown file
  • output_file: (Optional) Path to the output HTML file
  • template: (Optional) Template to use for HTML output

Returns the HTML content as a string if output_file is not specified.

to_tokens(md_file, output_file=None)

Generates tokens from a Markdown file.

  • md_file: Path to the input Markdown file
  • output_file: (Optional) Path to the output token file

Returns the list of tokens if output_file is not specified.

⚠️ Disclaimer

The HTML output generated by yamper is not automatically sanitized. This means that any potentially harmful or malicious content within the Markdown input will be directly reflected in the resulting HTML file. Users should be cautious when processing untrusted or user-generated content.

💡 Recommendation

If you intend to display the generated HTML on a website or share it publicly, it is strongly advised to manually review and sanitize the content, or use a dedicated HTML sanitizer to mitigate potential security vulnerabilities.

🤝 Contributing

Contributions to yamper are welcome! Please feel free to submit a Pull Request.

📜 License

This project is licensed under the GPL-3.0 license.

Metadata

Release files for yamper 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 yamper 0.1.0
File Size Uploaded Provenance
yamper-0.1.0.tar.gz 43.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 86.1 kB

Release files / yamper-0.1.0.tar.gz

Download URL yamper-0.1.0.tar.gz
Size 43.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4494da4613b90315c8e3d73e81419d93ba7aa3cc0fd2dceeb1b4cea55e31b0b0
BLAKE2b-256 checksum
How to use checksums
3c46f34df69bd484c3018708a56b53d243ea781a33abc6d7c7c9bf57305cb86a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

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

Download URL yamper-0.1.0-py3-none-any.whl
Size 42.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
129fd15603e68db690d288b16b691040a4f20e07c79c4167fdbc7cba726b85cc
BLAKE2b-256 checksum
How to use checksums
13979bb4e770021e5fd98a64831669ec00d4d2eda488a75e36541780d2a4743b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Security for yamper 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