Coder Social home page Coder Social logo

sublimepandoc's Introduction

Pandoc Plugin for Sublime Text 2

A Sublime Text 2 plugin for calling the Pandoc Markdown renderer to create HTML and DocX output. Pandoc does a LOT more than this but this is the specific functionality I use.

Installation

The easiest way is to install "SublimePandoc" using Package Control.

You can also grab the latest from Github and install it into your Sublime Text 2 Packages folder.

$ git clone git://github.com/jclement/SublimePandoc.git

Dependencies

You'll need to download and install [Pandoc] and have it in your PATH.

Available Commands

pandoc_render will render the markdown to HTML or DOCx and takes the following optional arguments:

  • writeBeside - When set will output the rendered result in the same folder, and with the same name as the source file. This requires that the buffer has already been saved and has a filename. Defaults to FALSE.
  • openAfter - When set will open the resulting document after rendering it. Defaults to FALSE.
  • target - Can be either 'html' or 'docx'. Defaults to 'html'.
  • additionalArguments - A list of additional arguments to pass to Pandoc.

Menu items for common tasks should show up under Tools > Pandoc.

Output Hints

The following hints can be added in your document to flip on additional features in Pandoc. (Note: these hints are processed by the plugin and NOT part of Pandoc itself)

<!-- [[TOC]] -->: Add a Table of Contents to the top of your output document.

<!-- [[NUM]] -->: Turn on numbering of sections.

Templates

"template.html" controls the output of the HTML documents and "reference.docx" is used for style definitions for DOCX output.

Note: If you are using a pre-built binary of Pandoc you will be unable to customize the reference.docx using Microsoft Word in versions <= 1.9.1

Sample Keybindings

The default keymapping on Windows...

[
  { "keys": ["ctrl+alt+r"],     
    "command":"pandoc_render", 
    "args":{"openAfter":true,   "target":"html",  "writeBeside":false},
    "context":[{"key": "selector", "operator": "equal", "operand": "text.html.markdown" }]},

  { "keys": ["ctrl+alt+shift+d"],   
    "command":"pandoc_render", 
    "args":{"openAfter":true,   "target":"docx",  "writeBeside":true},
    "context":[{"key": "selector", "operator": "equal", "operand": "text.html.markdown" }]},

  { "keys": ["ctrl+alt+shift+r"],   
    "command":"pandoc_render", 
    "args":{"openAfter":false,  "target":"html",  "writeBeside":true},
    "context":[{"key": "selector", "operator": "equal", "operand": "text.html.markdown" }]}
]

Pandoc Path Settings on Windwos

The plugin will look for Pandoc path using sublime settings pandoc_path or pandoc_bin.
The default settings should work under OS X without a problem. On windows, to set up the path correctly, change the Pandoc.sublime-settings to this:

{
    // undefine the default path
    //"pandoc_path": "~/Library/Haskell/bin"
    
    // provide the full path for pandoc.exe here
    "pandoc_bin": "c:\\Users\\example\\AppData\\Local\\Pandoc\\pandoc.exe"
}
~~~~


[Pandoc]: http://johnmacfarlane.net/pandoc/

sublimepandoc's People

Contributors

jclement avatar hamxiaoz avatar zyxar avatar nh2 avatar tema-popov avatar

Watchers

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