GithubHelp home page GithubHelp logo

masantos / md4sublime Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 17 KB

Wrapper around pandoc for working with markdown files in sublime; Creates builds for browser rendering and pdf generation

Shell 100.00%

md4sublime's Introduction

MD4SUBLIME

Markdown for Sublime Text.

A wrapper around pandoc for working with markdown files in sublime.

Creates sublime builds for browser rendering and pdf convertion of markdown files.


Requirements

This script requires pandoc, a document converter written in Haskell. Hence, you'll need to install first Haskell, then Pandoc, before making use of this script.

Another big (in terms of download&HD footprint) dependency is pdflatex. That is, you need a working LaTeX installation. This is necessary only for converting your markdown into a PDF file.

Note: Read the above link for Pandoc, if you don't know yet what it does. If you work with different document types it may be worth to have Pandoc -even if for that you need Haskell installed. If you're doing researc in any of the STEM sciences, you probably already have LaTeX installed. Also, Haskell is arguably the coolest and more promising purely-functional, strong-statically-typed programming languages around.

Status

Only tested for the following environment:

  • OSX 10.6.8 Snow Leopard (I know, I know,...walking alone in the desert :-p )
  • Firefox
  • Sublime Text 2

Actually, I have tested it as well for Firefox and Sublime Text 2 & 3 in Debian 8 Jessie (latest as of Sept. 2016). However only through manual installation and only so for previous versions (as of Wed Sep 28).

Sublime user defined builds

In order to build a project in sublime one can go to Tools -> Build System and choose the one appropiate to our project (say Make or C++ or Python) and then trigger it on the file we are currently editing by clicking on Tools -> Build ( command+B/ctrl+B in Mac/:Linux) .

Under Packages/User Sublime Text lets you define different build methods. These are given in JSON format. The format is

{
  "cmd": ["_build-script_","_args_", "$file"]
}

where build-script is the script you want to use to build your project and args is the string of arguments you need to pass your build script in order to process the file. $file will be the file you apply the build script on.

md4sublime

Markdown for Sublime

Provides build-scripts for converting a markdown file to HTML or PDF, and also for opening it in the browser.

  • Requires: pandoc
  • INPUT: markdown file.md
  • OUTPUT: browser window with file.md rendered as html It creates a temporary html version under .file.md within the PWD
  • AUTHOR: Miguel A. santos

Licensed as Public Domain 2016

Usage and output depends on what we want to achieve.

Options:

-h|-help|--help)               No help so far. Seee source code.
--pdf)                         Convert to PDF                               Generate PDF file from markdown
-F|--fire*|--Fire*)            Open markdown file in BROWSER = FIREFOX;;    Will show markdown file in Firefox
-C|--chro*|--Chro*)            Open markdown file in BROWSER = CHROME       Idem, but in Chrome (not yet fully tested)
--debug)                       DEBUGMODE=true ; KEEPHTML=true ; set -x ;;   Print detail log in sublime console.
--keep|--keephtml|--keep-html) KEEPHTML=true ;;                             Keep generated html file when rendering in browser.               
--install) shift; install_this ; exit;;                                     Create sublime builds & install system wide.

md4sublime build scripts

It installs two sublime build-scripts:

  1. Browser.sublime-build: For viewing markdown in a browser
{
   "cmd": ["/usr/local/bin/md4sublime", " ", "$file"]
}
  1. md2pdf.sublime-build: For converting your markdown file into PDF format
{
   "cmd": ["/usr/local/bin/md4sublime", "--pdf", "$file"]
}

Installation

./md4sublime --install

Careful: Full system-wide installation will ask for root password. Check the script first to make sure it fits your system.

The default installation directory for the script is in /usr/local/bin.

The sublime builds will be installed within path_to_sublime/Packages/User/

md4sublime's People

Contributors

masantos avatar

Watchers

James Cloos avatar  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.