Giter VIP home page Giter VIP logo

easy-pandoc-templates's Introduction

easy pandoc templates

A collection of portable pandoc templates with no dependencies

requires pandoc

Screenshot

Live Demo

quick start

install

# Clones repo to /tmp and copies templates to ~/.pandoc/templates

curl 'https://raw.githubusercontent.com/ryangrose/easy-pandoc-templates/master/copy_templates.sh' | bash

usage

# pandoc source.md -o destination.html --template=template_name.html

pandoc 'https://raw.githubusercontent.com/jgm/pandoc/master/MANUAL.txt' -f markdown -o sample.html --template=easy_template.html --toc

motivation

I was tired of how complicated making a nice-looking html page with pandoc was, so I decided to simplify it. CSS files were a good start, but to use anything more complicated (such as bootstrap or javascript files) I needed templates. The problem was that most templates used static references to local files, which required the file to be in the same directory as these files. In other words, you were forced to write your documents in the cloned repo directory.

To solve this, I turned to the ubiquity of CDNs and github. I began by converting the static references to css, js, etc files to ones loaded via CDN in the html head block. This made the templates portable as well as always up-to-date since the CDN (rawgit) pulls from Github.

usage

Use it just like any other pandoc template, but don't worry about where the extraneous files are (like css, js, etc)

# pandoc source.md -o destination.html --template=template_name.html

pandoc source.md -o destination.html --template=easy_template.html

Pandoc will look in ~/.pandoc/templates for files with the template name.

Don't forget to add --toc if you want a table of contents.

If you want the document to work offline, add the --standalone flag to pull all of the headers into the final document. See the pandoc manual for more info

installation

To install all the templates:

# Clones repo to /tmp and copies templates to ~/.pandoc/templates

curl 'https://raw.githubusercontent.com/ryangrose/easy-pandoc-templates/master/remote_install.sh' | bash

To install a single template, copy the given template to ~/.pandoc/templates.

# curl '<url to raw html template in this repo>' > ~/.pandoc/templates/<template name>

curl 'https://raw.githubusercontent.com/ryangrose/easy-pandoc-templates/master/html/easy_template.html' > ~/.pandoc/templates/easy_template.html

gallery

elegant bootstrap

A nice looking responsive template using bootstrap. Can create a nice table of contents menu

Live Demo

uikit

Live Demo

bootstrap

A nice looking responsive template using bootstrap. Can create a nice table of contents menu

Live Demo

extras

auto-updating

filewatcher is a ruby gem that automatically executes a given command when a file changes. Using this with pandoc provides a convenient way to view the compiled file in real time. Note: the browser doesn't auto refresh on file change, so that still needs to be done by hand.

Look at filewatcher's docs for more info

filewatcher README.md 'pandoc README.md -o README.html --template=bootstrap_menu.html'

vim

Want to preview your markdown file instantly in the browser? Add the following line to your .vimrc to bind Ctrl-m to compile vim's current file and display it in firefox. Feel free to change the template as you please

# For firefox
noremap <C-M> :! pandoc '%:p' -o /tmp/'%:p:t'.html --template=easy_template.html --toc && firefox /tmp/'%:p:t'.html &<CR><CR>

# For chrome
noremap <C-M> :! pandoc '%:p' -o /tmp/'%:p:t'.html --template=easy_template.html --toc && google-chrome /tmp/'%:p:t'.html &<CR><CR>

contributing

It's a simple concept, so if you've got an idea send me a pull request! You can also see a primitive roadmap for ideas

easy-pandoc-templates's People

Contributors

ryangrose avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.