Commit cfbbab5a authored by ALO's avatar ALO

Initial commit

parents
# Mardown utils
## Presentation
`markdown-utils` allow user to convert a Markdown file to PDF with a default
configuration.
## Installation
Install markdown utils with the following commands:
```bash
sudo apt-get install rubygems-integration wkhtmltopdf ruby-dev
sudo gem install gimli
```
## Usage
### Configuration
You need to source markdown-utils.sh in your `~/.bash_aliases` :
```bash
source <path to markdown-utils>/markdown-utils.sh
```
### Convert a file
`md2pdf <md file path>`
The PDF will be created to the current directory
### See a PDF file
Use this to see a PDF file without keeping it
`mdtest <md file path>`
#! /bin/bash
# markdown-utils.sh
# utilities to convert markdown files
SCRIPT_PATH=$(dirname $0)
function md2pdf() {
USAGE="usage: $0 mdFilePath [outDirectory]"
[[ -z ${1} ]] && echo ${USAGE} >&2 && exit 1
MD_FILE=${1}
OUT_DIR_OPTION=""
[[ -n ${2} ]] && OUT_DIR_OPTION="-o ${2}"
gimli -f ${MD_FILE} -s ${SCRIPT_PATH}/style.css -w '-t ' ${OUT_DIR_OPTION}
}
function mdtest() {
USAGE="usage: $0 mdFilePath"
[[ -z ${1} ]] && echo ${USAGE} >&2 && exit 1
MD_FILE=${1}
OUT_DIR=$(mktemp -d)
OUT_FILENAME=${MD_FILE/%.md/.pdf}
md2pdf ${MD_FILE} ${OUT_DIR}
evince ${OUT_DIR}/${OUT_FILENAME}
# Clean temp files
rm ${OUT_DIR}/${OUT_FILENAME}
rmdir ${OUT_DIR}
}
/*
This document has been created with Marked.app <http://marked2app.com>
Please leave this notice in place, along with any additional credits below.
---------------------------------------------------------------
Title: Ulysses Freestraction Light
Author: Jonathan Poritsky <http://candlerblog.com>
Description: Based on the Freestraction color scheme used in Ulysses III <http://www.ulyssesapp.com>.
For more information read the introductory post: http://candlerblog.com/2013/04/11/ulysses-iii-and-marked/
*/
/*
This document has been modified by me
Please leave this notice in place, along with any additional credits below.
---------------------------------------------------------------
Author: Antoine Loheac <antoine.loheac@smile.fr>
*/
html {
color: #656565;
}
body {
padding: 2em;
border: 0;
font-size: 1em;
line-height: 1.7em;
font-family: "Source Sans Pro","Helvetica Neue",Helvetica,sans-serif;
max-width: 35em;
}
a {
padding:0 0.3em 0.1em 0.3em;
color: #656565;
background: #f7f7f7;
text-decoration:none;
border: 1px solid #d4d4d4;
border-radius: 4px;
}
a:hover {
padding:0 0.3em 0.1em 0.3em;
text-decoration: none;
background:-webkit-gradient(linear, 80% 20%, 80% 100%, from(#315983), to(#224C78));
color: #f7ffff;
border-top: 1px solid rgb(69,105,143);
border-bottom: 1px solid rgb(47,76,105);
border-right: 1px solid rgb(47,76,105);
border-left: 1px solid rgb(47,76,105);
border-radius: 4px;
box-shadow: 0px 0px 0px 1px rgb(47,76,105);;
}
h1, h2, h3, h4, h5, h6 {
/* text-align: center; */
color: rgb(12,139,186);
line-height: 1;
font-weight: 600;
font-family: "Minion Pro","Chaparral Pro",Georgia,serif;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 1.6em;
}
h3 {
font-size: 1.4em;
}
h4 {
font-size: 1.2em;
}
h5 {
font-size: 1.1em;
}
h6 {
font-style: italic;
font-size: 1em;
}
ol, ul {
margin-left: -15px;
margin-right: 25px;
}
ul li {
/* list-style: none; */
}
/* ul li:before { */
/* content:'\2010'; */
/* display: block; */
/* position: relative; */
/* max-width: 0; */
/* max-height: 0; */
/* left: -.8em; */
/* top: -.1em; */
/* color: rgb(12,139,186); */
/* font-size:1.2em; */
/* } */
li {
font-size: .9em;
}
li p {
-webkit-margin-before: 0;
-webkit-margin-after: 0;
}
.footnote {
font-size: 50%;
vertical-align: super;
}
div.footnotes {
font-size: 80%;
}
pre, code {
white-space: pre-wrap;
}
blockquote {
background:rgb(230,230,230);
display: block;
font-style:italic;
font-weight:200;
color: rgb(12,139,186);
padding:0.2em 2em 0.2em 2em;
-webkit-margin-before: 1em;
-webkit-margin-after: 1em;
-webkit-margin-start: 0;
-webkit-margin-end: 0;
}
code {
font-family: Inconsolata,"Courier Prime",mono;
font-size:80%;
padding: 2px;
color: rgb(20,126,73);
background: rgb(224,232,228);
}
.line-numbers {
display: none
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment