MarkupEmail
Converting Markup to e-mails
Installation
From rubygems.org
gem install markup-email
# Then use the executables
markup-email [file] [options]
From source (without gems)
git clone https://github.com/Demonstrandum/MarkupEmail.git && cd MarkupEmail
cat *.gemspec # Read through and download all runtime dependencies
ruby -Ilib bin/markup-email [file] [options] # Then you can use the program
Usage
Basic usage:
markup-email [markup file] [options]
e.g. markup-email -s email.md -t 'Special E-mail'
Options:
| Option | Description |
|---|---|
| -s, --sanitize | Sanitizes all html/markdown by removing potentially harmful tags or their attributes |
| -t, --title | The subsequent word/argument will be set as the title |
| -h, --help, help | Brings up the help menu (similar as this) |
Your chosen markdown requires these packages accordingly:
- .markdown, .mdown, .mkdn, .md --
gem install commonmarker - .textile --
gem install RedCloth - .rdoc --
gem install rdoc -v 3.6.1 - .org --
gem install org-ruby - .creole --
gem install creole - .mediawiki, .wiki --
gem install wikicloth - .rst --
python3 -m pip install sphinx - .asciidoc, .adoc, .asc --
gem install asciidoctor - .pod -- Pod::Simple::XHTML comes with Perl >= 5.10.
Delete the example .html in this repo's examples folder and generate it yourself
$ markup-email -s -t veryExampleWow examples/example.md
Title is : veryExampleWow
Filename is : veryExampleWow.html
Markup/HTML will be sanitized,
(`class=...` attributes and <script> tags will be disalowed).
E-mail it
Then open examples/veryExampleWow.html in your browser and see for yourself, then you can open it in a text-editor, view the source and copy it in to your e-mail editor as HTML source.
In Ruby
Can also be used in Ruby
require 'markup_email'
file = ... # Markdup file
title = ... # Title of the page
markup = MarkupEmail::Convert.new(file, title, sanitize)
puts markup.content # Will print the pure HTML
markup.write "#{file.split('.')[0..-2].join('.')}-converted.html" # Makes a new file
# If `file` was equal to "hello.there.md"
# then the new file from `markup.write()` would be called
# "hello.there-converted.html"
If this is not sufficient, perhaps see the rubydoc.info for autogenerated documentation.