Skip to content

ebzzry/emem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

emem

Build Status

emem is a trivial Markdown to HTML converter. This library leverages on markdown-clj, and hiccup to produce HTML.

Installation

Leiningen

[emem "0.2.50-SNAPSHOT"]

Maven

<dependency>
  <groupId>emem</groupId>
  <artifactId>emem</artifactId>
  <version>0.2.50-SNAPSHOT</version>
</dependency>

Binaries

Nix

Install Nix, if you don’t have it, yet:

$ curl http://nixos.org/nix/install | bash

Then, install emem with:

$ nix-env -iA nixpkgs.emem

Uberjar

If you can’t use Nix, or you just want the JAR file, you can build a standalone JAR file that contains all the dependencies. To create one, install Leiningen, first. To build the JAR, run the following command inside the checkout directory:

$ lein uberjar

This command generates two JAR files. The file that we need is the standalone one—./target/uberjar/emem-0.2.50-SNAPSHOT-standalone.jar. Copy this file to ~/bin, as emem.jar.

$ cp target/uberjar/emem-0.2.50-*-standalone.jar ~/bin/emem.jar

Next, create a shell script to ease typing.

$ emacs ~/bin/emem

Then, put the following:

#!/bin/sh
java -jar $HOME/bin/emem.jar $@

Save your changes, then make it executable:

$ chmod +x ~/bin/emem

Windows 32-bit PE

Once you have the standalone JAR, creating a Windows exe is relatively easy. Download Launch4j and use it to create the executable. The bare-minimum fields are:

  • Basic > Output file
  • Basic > Jar
  • Header > Header type
  • JRE > Min JRE version

The Output file and Jar fields are self-explanatory. For Header type, select Console, while for Min JRE version, specify 1.1.0.

Releases

If you are unable to build a JAR or EXE, you may download a binary release.

Usage

CLI

To convert README.md to README.html:

$ emem README.md

To convert all .md files in the current directory:

$ emem .

To convert README.md and embed the CSS data to a standalone README.html:

$ emem -s README.md

To convert all .md files in the directory ~/Desktop/notes/:

$ emem ~/Desktop/notes/

To convert all .md files in the current directory, and output them to the html/ directory:

$ emem -d html .

To change the top-level CSS:

$ emem -M custom.css list.md

To change the syntax highlighter CSS:

$ emem -S zenburn repairs.md

To list the available syntax highlighter styles:

$ emem -L | paste - - | expand -t 35

To inline CSS:

$ emem -C 'html { color: #FFF; background: #000; }' README.md

To use full page width:

$ emem -f README.md

To build in continuous mode:

$ emem -c ~/Desktop/notes/

In continuous mode emem will wait for changes to your files. When a change has been detected, it automatically rebuilds the HTML files. It will remain to monitor for changes, until Ctrl-C is pressed. The continuous mode works great when used with browser extensions that reload a page when a page gets updated. The ones I can suggest are:

When ran without arguments, emem will accept input from stdin. The following command accepts any Markdown-valid input, including regular text, then outputs to screen the raw HTML equivalent, using the -w option. It will remain to accept input, until Ctrl-D is pressed:

$ emem -w
# foo
**bold**
_emph_
^D

The following is an equivalent command of the above:

$ echo '# foo\n**bold**\n_emph_' | emem -w

To learn more about the available options:

$ emem -h

An example of how emem is used to generate pages can be found here.

A short tutorial for common use cases is available here.

API

Add the following expression to (ns ...):

(:require [emem.core :as mm])

To convert README.md to README.html:

(mm/convert "README.md")

To convert README.md to foo.html:

(mm/convert "README.md" "foo.html")

To convert multiple files:

(mm/convert ["foo.md" "bar.md" "baz.md"])

To convert multiple files, to different output names:

(mm/convert ["foo.md" "bar.md" "baz.md"]
            ["mu.html" "ka.html" "mo.html"])

To merge multiple files, to reminders.html:

(mm/convert ["buy.md" "projects.md" "fitness.md"]
            :merge true
            :out "reminders.html")

To convert a Markdown string to an HTML string:

(mm/markdown "# Blah")

To learn more about the available options:

(doc mm/convert)

Dependencies

License

Copyright 2015–2017 Rommel Martinez

Distributed under the Eclipse Public License

About

Trivial Markdown to HTML converter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published