456

I'm wondering if there is a command line utility for taking a GitHub flavored Markdown file and rendering it to HTML.

I'm using a GitHub wiki to create website content. I've cloned the repository on my server and would then like to process it into regular HTML. It's important to me that what appears on GitHub is exactly how it should look for my website. I'd also really like to use the fenced blocks with ~~~, so I'd rather not use standard Markdown syntax only.

I've looked a bit into the JavaScript live preview thinking I could hook it into Node.js, but they say it is deprecated. I've looked at the redcarpet repository, but it doesn't look like it has a command line interface.

I rolled my own solution, however, since no solution here is clearly better than the others, I'll leave the question without a selected answer.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
McLeopold
  • 5,967
  • 5
  • 21
  • 14
  • 2
    RE: UPDATE: If I added an `--out` argument to grip to render to an HTML file instead of the browser, would that be acceptable? – Joe Jan 30 '13 at 21:43
  • @Joe please do add that option! – bguiz Aug 01 '13 at 07:29
  • 1
    @McLeopold @bguiz just deployed the `--export` option, which renders GFM and its styles to a single file. Does this answer the question? – Joe Sep 27 '13 at 04:46
  • @Joe sweet, shall check it out! – bguiz Sep 30 '13 at 00:15
  • 3
    @McLeopold, Joe kind of knocked this out of the park by creating a simple reusable solution, might want to give him the answer. – James McMahon Feb 14 '14 at 19:49
  • I don't know if this is still relevant, but as @gringo-suave pointed out in his answer, there is the Markdown Python module that allows the use of extensions. Check out their [page](http://pythonhosted.org/Markdown/) for more information. There is even an extension for fenced code blocks and code highlight! – pedromanoel Aug 15 '14 at 18:05
  • Check out this [gist](https://gist.github.com/pedromanoel/721177b91baae9fa2727#file-md2html) for an example on how to do it. – pedromanoel Aug 15 '14 at 18:18
  • `pandoc -s -f markdown -t man "my documentation file.markdown" | man -l -` (from http://stackoverflow.com/a/7603703/563329) – isomorphismes Aug 29 '15 at 20:47
  • 1
    **Github itself uses Sundown**. See http://stackoverflow.com/a/7694931/632951 – Pacerier Feb 18 '16 at 19:17
  • It is https://github.com/github/markup – onmyway133 May 24 '16 at 12:25
  • Since @McLeopold need _to HTML_, for generic Markdown should be: `pandoc input.md -f markdown -t html -s -o output.html`. _-s, --standalone: Produce output with an appropriate header and footer_ – Pablo Bianchi May 02 '17 at 20:18

26 Answers26

489

I wrote a small CLI in Python and added GFM support. It's called Grip (Github Readme Instant Preview).

Install it with:

$ pip install grip

And to use it, simply:

$ grip

Then visit localhost:5000 to view the readme.md file at that location.

You can also specify your own file:

$ grip CHANGES.md

And change port:

$ grip 8080

And of course, specifically render GitHub-Flavored Markdown, optionally with repository context:

$ grip --gfm --context=username/repo issue.md

Notable features:

  • Renders pages to appear exactly like on GitHub
  • Fenced blocks
  • Python API
  • Navigate between linked files (thanks, vladwing!) added in 2.0
  • Export to a single file (thanks, iliggio!) added in 2.0
  • New: Read from stdin and export to stdout added in 3.0

Check it out.

starball
  • 20,030
  • 7
  • 43
  • 238
Joe
  • 16,328
  • 12
  • 61
  • 75
  • 1
    Works really well and you can't beat ease of install for Pythonistas! – RichVel Apr 02 '13 at 13:22
  • 36
    This should be a first hit for "github markdown preview." Everything else is complicated, doesn't work, or doesn't do all the GitHub features. `grip` works right out of the box. – Bluu Apr 30 '13 at 18:16
  • Thanks for the hint, a real great package. Is there a reason why there is no HTML (css-inclusive) export? – ProfHase85 Jul 08 '13 at 12:13
  • Does this work with Python3.x? Because I tried installing, and it seems like it may have a dependency on `flask`, which does not appear to be supported with Python3.x. See https://github.com/mitsuhiko/flask/issues/339 – Houdini Aug 28 '13 at 13:56
  • 1
    @Houdini That issue is out of date. Flask does support 3.3, see http://flask.pocoo.org/docs/python3/. Here's a more recent Github thread on the topic https://github.com/mitsuhiko/flask/issues/587. If there's another dependency that needs updated, feel free to open an issue or a pull request. – Joe Aug 28 '13 at 15:50
  • 4
    It should be noted that this package requires an active internet connection and your github authentication credentials (provided at command line) if you do more than 60 refreshes per hour. – leo Mar 31 '15 at 21:46
  • @leo You can use a personal auth token instead of your credentials. That's actually recommended instead of exposing your password. https://github.com/joeyespo/grip#access – Joe Mar 31 '15 at 22:04
  • 1
    This is great for creating local mirrors of Github wikis. First clone your wiki by running this command like this (replace .git with .wiki) `git clone https://github.com/user/project.wiki`. Then you can host it locally with grip for a killer combo :) – Gourneau Aug 26 '15 at 00:00
  • 1
    @Gourneau Thanks for sharing! Just added a 'Tips' section to the Readme with this https://github.com/joeyespo/grip#tips :-) – Joe Sep 21 '15 at 03:16
  • 17
    As mentioned earlier, I don't think this is a particularly great solution because all it does it goes off to Github and gets Github to render your Markdown. It requires a working internet connection with access to Github, and if Github dies then this tool stops working. I'd rather have a completely offline solution. – Jez Nov 09 '15 at 12:07
  • For debian users, you can run grip via ```python -m grip [options]```, since there is no executable placed in the PATH directories. – yobiscus Dec 08 '15 at 16:40
  • I got grip 4.2.0 from a pip install and it works as a server but the --export function doesn't work. It just hangs. Anyone else have this problem? Of course if you want an HTML file you can always save-as from the browser. – AlanObject Jun 24 '16 at 20:45
  • @AlanObject There's an issue that was recently opened that I think is related. (https://github.com/joeyespo/grip/issues/180) I'll take a look at it next week! Feel free to comment there or open a new issue anyway to make sure the specific issue you're seeing is addressed. – Joe Jun 24 '16 at 21:12
  • Latest 4.3.2 for me (on Windows) only supports page links with an explicit `.md` suffix (rather than the normal syntax of just the page name). Am I missing something here? – Stuart Rossiter Feb 22 '17 at 14:21
  • Hmm [this](https://help.github.com/articles/adding-links-to-wikis/) says the `[link text](link URL)` format I was using should always be the full URL (i.e. with the suffix). Yet GitHub allows it not to have the `.md` suffix and work. – Stuart Rossiter Feb 22 '17 at 14:28
  • ...and including the suffix on GitHub gives me a link to the raw source of the page, not it rendered (i.e., I have to use the suffix-less links). Huh? – Stuart Rossiter Feb 22 '17 at 14:35
  • @StuartRossiter Want to open an issue? I'd be happy to look into it. It might be easier to drill down into the details there instead of in comments here https://github.com/joeyespo/grip/issues – Joe Feb 23 '17 at 20:40
  • 1
    Unfortunately, it doesn't seem to support GFM tables which is what I need. – JESii Feb 18 '19 at 01:28
  • nice tool! I was expecting something that would render it in the cli though. – Alexander Oh Jul 29 '19 at 12:34
  • 1
    @AlexanderOh You can output to file with `grip file.md --export file.html` – wisbucky Feb 18 '22 at 00:38
  • Pretty cool tool since it uses Github API, so it's an exact rendering. One inherent downside is that it adds a ton of css and header code. – wisbucky Feb 18 '22 at 00:40
120

I've not found a quick and easy method for GitHub-flavoured Markdown, but I have found a slightly more generic version - Pandoc. It converts from/to a number of formats, including Markdown, Rest, HTML and others.

I've also developed a Makefile to convert all .md files to .html (in large part to the example at Writing, Markdown and Pandoc):

# 'Makefile'
MARKDOWN = pandoc --from gfm --to html --standalone
all: $(patsubst %.md,%.html,$(wildcard *.md)) Makefile

clean:
    rm -f $(patsubst %.md,%.html,$(wildcard *.md))
    rm -f *.bak *~

%.html: %.md
    $(MARKDOWN) $< --output $@
Dale Wijnand
  • 6,054
  • 5
  • 28
  • 55
Alister Bulman
  • 34,482
  • 9
  • 71
  • 110
  • 4
    i've been using "watch pandoc ..." to continuously convert a markdown file to html, and the chrome "live reload" extension to get real time "stay where i'm scrolled too" functionality with this, and it works great. https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei?utm_source=gmail – Brad Parks Nov 29 '13 at 10:39
  • 3
    Pandoc reads GFM fine but it doesn't generate the same HTML GitHub does -- for instance, if you have a multi-line `
    ` tag in your GFM source, Pandoc will put `
    ` tags in for the line breaks in it, while GitHub's renderer, though it strips leading whitespace, seems to otherwise leave the content alone.
    – David Moles Mar 10 '15 at 22:38
  • 1
    How does one go about getting nice styling on the resulting HTML? My output is still rendered with Times New Roman, for example. – Holistic Developer Aug 25 '18 at 18:49
  • 1
    Pandoc install instructions are [here](http://pandoc.org/installing.html). On macOS: `brew install pandoc` – Master of Ducks Oct 08 '18 at 08:20
  • 2
    neither the `gfm` nor the `markdown_github` input formats correctly render things like code blocks. – user5359531 Oct 29 '19 at 19:25
  • it also does not correctly interpret the YAML or pandoc header metadata blocks – user5359531 Oct 29 '19 at 19:27
  • pandoc's output downloads a file from Cloudflare for IE 9 compatibility – Boris Verkhovskiy Oct 05 '21 at 16:20
31
pip3 install --user markdown
python3 -m markdown readme.md > readme.html

It doesn't handle GitHub extensions, but it is better than nothing. I believe you can extend the module to handle the GitHub additions.

Gringo Suave
  • 29,931
  • 6
  • 88
  • 75
29

Maybe this might help:

gem install github-markdown

No documentation exists, but I got it from the gollum documentation. Looking at rubydoc.info, it looks like you can use:

require 'github/markdown'  
puts GitHub::Markdown.render_gfm('your markdown string')

in your Ruby code. You can wrap that easily in a script to turn it into a command line utility:

#!/usr/bin/env ruby

# render.rb
require 'github/markdown'

puts GitHub::Markdown.render_gfm File.read(ARGV[0])

Execute it with ./render.rb path/to/my/markdown/file.md. Note that this is not safe for use in production without sanitization.

James Lim
  • 12,915
  • 4
  • 40
  • 65
  • 1
    Thanks Jim, due to virtually non-existent examples, I was stuck at the require step (replacing dash with slash made it).. ;) – plesatejvlk Aug 05 '15 at 09:13
  • This is great if you're already using NPM. I had to use it, on account of DOxygen causing me constant problems with specifically github-flavored markdown + exporting to HTML. – kayleeFrye_onDeck Mar 04 '16 at 18:41
  • 1
    is this running locally or is it sending data out to GitHub API? – user5359531 Oct 29 '19 at 19:24
26

To read a README.md file in the terminal I use:

pandoc README.md | lynx -stdin

Pandoc outputs it in HTML format, which Lynx renders in your terminal.

It works great: It fills my terminal, shortcuts are shown below, I can scroll through, and the links work! There is only one font size though, but the colors + indentation + alignment make up for that.

Installation:

  • apt: sudo apt-get install pandoc lynx
  • nix: nix-shell -p pandoc lynx
toraritte
  • 6,300
  • 3
  • 46
  • 67
Barry Staes
  • 3,890
  • 4
  • 24
  • 30
  • 1
    The question is specifically about command-line usage. Before writing your own ruby script (or egad node server), give this a shot. – Cora Middleton Jan 12 '15 at 18:22
  • Exactly this works inside your terminal. Or if your favorite (desktop?) browser can access that folder use `pandoc readme.md -o readme.md.html` and open the resulting file. – Barry Staes Jan 13 '15 at 10:26
  • @baerry-staes Yes, sorry, I hope it was clear that yours was my favored answer. – Cora Middleton Jan 13 '15 at 15:29
  • @JustinMiddleton yes i got that, thank you. My comment was just to add some extra info for desktop users.. i figured someone someday reading this might find it useful. – Barry Staes Jan 14 '15 at 13:52
  • 1
    I've tried about 5-6 other console md readers and this has by far been the best solution. I just added the most basic function to my config to make it a little quicker to use. `function md { pandoc $@ | lynx -stdin }` – Russ Brown Jul 25 '19 at 16:10
24

Probably not what you want, but since you mentioned Node.js: I could not find a good tool to preview GitHub Flavored Markdown documentation on my local drive before committing them to GitHub, so today I created one, based on Node.js: https://github.com/ypocat/gfms

So perhaps you can reuse the showdown.js from it for your Wiki, if your question is still actual. If not, maybe other people facing the same problem as I did will find (just as I did) this question and this answer to it.

youurayy
  • 1,635
  • 1
  • 18
  • 11
  • 1
    Well done, man. Saves me from having to resort to Ruby or Python when I'm writing a node application, which is great. –  Jul 29 '15 at 21:03
19

GitHub has a Markdown API you can use.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
kehers
  • 4,076
  • 3
  • 30
  • 31
  • 8
    `jq --slurp --raw-input '{"text": "\(.)", "mode": "markdown"}' < README.md | curl --data @- https://api.github.com/markdown > README.html` – Vebjorn Ljosa Apr 08 '15 at 18:46
  • 1
    @VebjornLjosa * that * or `grip`... You chose. :P – yyny Nov 27 '15 at 21:56
  • `grip` is amazing. But, unfortunately, due to its name it is not possible to find it easily if you forget how it is named. (not available via MacPorts either). – Alexander Kucheryuk Sep 10 '21 at 06:41
14

Use marked. It supports GitHub Flavored Markdown, can be used as a Node.js module and from the command line.

An example would be:

$ marked -o hello.html
hello world
^D
$ cat hello.html
<p>hello world</p>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
zemirco
  • 16,171
  • 8
  • 62
  • 96
  • 2
    I've noticed that this doesn't support features like syntax highlighting for code blocks and newer features like checklists. But hey it gets most of the way! – bguiz Aug 01 '13 at 07:38
  • Very nice, the only thing I'm missing is some borders for the tables. Well, at least I can render them at all, this is pretty much exactly what I need. Pipe in the GFM, pipe out HTML :) – Xandaros Oct 20 '14 at 13:42
  • I'm confused about this example, what is `^D`? – Matthew Feb 25 '20 at 13:32
  • Use it like `marked -o out.html -i in.md --gfm` – Gagan Oct 26 '22 at 08:08
13

I created a tool similar to Atom's Preview functionality, but as a standalone application. Not sure if this is what you're looking for, but it might be helpful. -- https://github.com/yoshuawuyts/vmd

vmd

Mateusz Piotrowski
  • 8,029
  • 10
  • 53
  • 79
Yoshua Wuyts
  • 3,926
  • 1
  • 20
  • 16
  • You guys still supporting this? I tried to install with NPM today, but no dice. >downloading electron-v0.36.9-win32-x64.zip >Error: self signed certificate – kayleeFrye_onDeck Mar 04 '16 at 18:50
  • 1
    Yeah, we are! What version of npm / node did you run this on? - feel free to open up an issue on GH and we'll take a look at this. Thanks! – Yoshua Wuyts Mar 07 '16 at 00:27
11

This is mostly a follow-on to @barry-staes's answer for using Pandoc. Homebrew has it as well, if you're on a Mac:

brew install pandoc

Pandoc supports GFM as an input format via the markdown_github name.

Output to file

cat foo.md | pandoc -f markdown_github > foo.html

Open in Lynx

cat foo.md | pandoc -f markdown_github | lynx -stdin # To open in Lynx

Open in the default browser on OS X

cat foo.md | pandoc -f markdown_github > foo.html && open foo.html # To open in the default browser on OS X`

TextMate Integration

You can always pipe the current selection or current document to one of the above, as most editors allow you to do. You can also easily configure the environment so that pandoc replaces the default Markdown processor used by the Markdown bundle.

First, create a shell script with the following contents (I'll call it ghmarkdown):

#!/bin/bash
# Note included, optional --email-obfuscation arg
pandoc -f markdown_github --email-obfuscation=references

You can then set the TM_MARKDOWN variable (in Preferences→Variables) to /path/to/ghmarkdown, and it will replace the default Markdown processor.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Cora Middleton
  • 956
  • 7
  • 13
10

pandoc with browser works well for me.

Usage: cat README.md | pandoc -f markdown_github | browser

Installation (Assuming you are using Mac OSX):

  • $ brew install pandoc

  • $ brew install browser

Or on Debian/Ubuntu: apt-get install pandoc browser

Martin Eden
  • 6,143
  • 3
  • 30
  • 33
binarymason
  • 1,351
  • 1
  • 14
  • 31
  • 1
    `apt-get isntall pandoc` will do, no need to use insecure, local stuff like brew. – Dominik George Sep 29 '16 at 09:30
  • 1
    @DominikGeorge there is a typo, it is _install_, not _isntall_ – Federico Tomassetti Oct 18 '16 at 08:15
  • 11
    @DominikGeorge there's no apt-get on macOS. – richrad Nov 16 '16 at 21:09
  • I was wondering what this `browser` is - it is just a shell script to create a temporary html file, and then call the system browser to open this file; https://formulae.brew.sh/formula/browser points to https://gist.github.com/defunkt/318247 which contains the script – sdbbs Feb 05 '23 at 21:11
9

I use Pandoc with the option --from=gfm for GitHub Flavored Markdown like this:

$ pandoc my_file.md   --from=gfm -t html -o my_file.html
Asme Just
  • 1,287
  • 5
  • 27
  • 42
9

Building on this comment I wrote a one-liner to hit the Github Markdown API using curl and jq.

Paste this bash function onto the command line or into your ~/.bash_profile:

mdsee(){ 
    HTMLFILE="$(mktemp -u).html"
    cat "$1" | \
      jq --slurp --raw-input '{"text": "\(.)", "mode": "markdown"}' | \
      curl -s --data @- https://api.github.com/markdown > "$HTMLFILE"
    echo $HTMLFILE
    open "$HTMLFILE"
}

And then to see the rendered HTML in-browser run:

mdsee readme.md

Replace open "$HTMLFILE" with lynx "$HTMLFILE" if you need a pure terminal solution.

notpeter
  • 1,046
  • 11
  • 16
6

Also see https://softwareengineering.stackexchange.com/a/128721/24257.


If you're interested in how we [Github] render Markdown files, you might want to check out Redcarpet, our Ruby interface to the Sundown library.

Ruby-script, which use Redcarpet, will be "command line utility", if you'll have local Ruby

Community
  • 1
  • 1
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • Haven't ideas - I don't write Ruby and I didn't read Redcarpet sources – Lazy Badger Nov 08 '11 at 12:33
  • @LazyBadger, **Sundown** is the actual parser (written in C). Redcarpet is not needed. – Pacerier Feb 18 '16 at 19:17
  • This is arguably the best solution, but you don't give actual instructions on what to do. So after installing the gem `gem install redcarpet`, suppose we're in a directory containing `README.md` what next? – stevec Nov 17 '20 at 04:11
4

There is a really nice and simple tool for browsing GFM Markdown documents:

GFMS - Github Flavored Markdown Server

It's simple and lightweight (no configuration needed) HTTP server you can start in any directory containing markdown files to browse them.

Features:

  • Full GFM Markdown support
  • Source code syntax highlighting
  • Browsing files and directories
  • Nice looking output (and configurable CSS stylesheets)
  • Export to PDF
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Pawel Wiejacha
  • 704
  • 7
  • 5
4

GitHub has (since) developed a nice modular text editor called Atom (based on Chromium and uses Node.js modules for packages).

A default preinstalled package Markdown Preview lets you display your preview in a separate tab using Ctrl + Shift + M.

I haven't tested its full syntax, but since it's coming from GitHub, I'd be highly surprised if the preview's syntax was different from theirs (fenced blocks using ~~~ work).

Now, while it's not technically command-line based, it uses Node.js and outputs to a DOM-based renderer, which might help anyone trying to render GitHub syntax-based HTML on a Node.js-based webserver, or just edit her/his README.md offline.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Que
  • 494
  • 4
  • 4
  • 1
    In Atom you can install a package called _gfm-pdf_ (https://atom.io/packages/gfm-pdf), which exports your markdown document to a HTML and/or PDF document. The library _wkhtmltopdf_ is required. – spren9er Sep 11 '15 at 20:30
4

My final solution was to use Python Markdown. I rolled my own extension that fixed the fence blocks.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
McLeopold
  • 5,967
  • 5
  • 21
  • 14
3

Late addition but showdownjs has a CLI tool you can use to parse MD to HTML.

Tivie
  • 18,864
  • 5
  • 58
  • 77
3

I managed to use a one-line Ruby script for that purpose (although it had to go in a separate file). First, run these commands once on each client machine you'll be pushing docs from:

gem install github-markup
gem install commonmarker

Next, install this script in your client image, and call it render-readme-for-javadoc.rb:

require 'github/markup'

puts GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, File.read('README.md'))

Finally, invoke it like this:

ruby ./render-readme-for-javadoc.rb >> project/src/main/javadoc/overview.html

ETA: This won't help you with StackOverflow-flavor Markdown, which seems to be failing on this answer.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Pr0methean
  • 303
  • 4
  • 14
  • I think this is the "closest to source" answer from all of them since these tools are the ones used by github. – memoselyk Oct 03 '18 at 14:00
2

Improving upon @barry-stae's solution. Stick this snippet in ~/.bashrc

function mdviewer(){
  pandoc $* | lynx -stdin
}

Then we can quickly view the file from the command-line. Also works nicely over SSH/Telnet sessions.

mdviewer README.md
Sandeep
  • 28,307
  • 3
  • 32
  • 24
1

A 'quick-and-dirty' approach is to download the wiki HTML pages using the wget utility, instead of cloning it. For example, this is how I downloaded the Hystrix wiki from GitHub (I'm using Ubuntu Linux):

 $ wget -e robots=off -nH -E -H -k -K -p https://github.com/Netflix/Hystrix/wiki
 $ wget -e robots=off -nH -E -H -k -K -I "Netflix/Hystrix/wiki" -r -l 1 https://github.com/Netflix/Hystrix/wiki

The first call will download the wiki entry page and all its dependencies. The second one will call all sub-pages on it. You can browse now the wiki by opening Netflix/Hystrix/wiki.1.html.

Note that both calls to wget are necessary. If you just run the second one then you will miss some dependencies required to show the pages properly.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Luis Rodero-Merino
  • 1,929
  • 1
  • 12
  • 8
0

Based on Jim Lim's answer, I installed the GitHub Markdown gem. That included a script called gfm that takes a filename on the command line and writes the equivalent HTML to standard output. I modified that slightly to save the file to disk and then to open the standard browser with launchy:

#!/usr/bin/env ruby

HELP = <<-help
  Usage: gfm [--readme | --plaintext] [<file>]
  Convert a GitHub-Flavored Markdown file to HTML and write to standard output.
  With no <file> or when <file> is '-', read Markdown source text from standard input.
  With `--readme`, the files are parsed like README.md files in GitHub.com. By default,
  the files are parsed with all the GFM extensions.
help

if ARGV.include?('--help')
  puts HELP
  exit 0
end

root = File.expand_path('../../', __FILE__)
$:.unshift File.expand_path('lib', root)

require 'github/markdown'
require 'tempfile'
require 'launchy'

mode = :gfm
mode = :markdown if ARGV.delete('--readme')
mode = :plaintext if ARGV.delete('--plaintext')

outputFilePath = File.join(Dir.tmpdir, File.basename(ARGF.path))  + ".html"

File.open(outputFilePath, "w") do |outputFile |
    outputFile.write(GitHub::Markdown.to_html(ARGF.read, mode))
end

outputFileUri = 'file:///' + outputFilePath

Launchy.open(outputFileUri)
Community
  • 1
  • 1
gerrard00
  • 1,628
  • 14
  • 17
  • 1
    I tried this with fenced blocks for Ruby and Cucumber. While the fences (```ruby, ```cucumber, etc.) appear to be recognized as fences (because they're rendered in fixed width text), there is no syntax highlighting. Any idea why? – Keith Bennett Jan 03 '14 at 20:43
0

Improving upon @barry-stae and @Sandeep answers for regular users of elinks you would add the following to .bashrc:

function mdviewer() {
  pandoc $* | elinks --force-html
}

Don't forget to install pandoc (and elinks).

daBertl
  • 11
  • 1
0

Another option is AllMark - the markdown server.
Docker images available for ready-to-go setup.

$ allmark serve .

Note: It recursively scans directories to serve website from markdown files. So for faster processing of single file, move it to a separate directory.

Mohnish
  • 1,905
  • 2
  • 17
  • 19
0

I found a website that will do this for you: http://tmpvar.com/markdown.html. Paste in your Markdown, and it'll display it for you. It seems to work just fine!

However, it doesn't seem to handle the syntax highlighting option for code; that is, the ~~~ruby feature doesn't work. It just prints 'ruby'.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
JESii
  • 4,678
  • 2
  • 39
  • 44
-1

I recently made what you want, because I was in need to generate documentation from Markdown files and the GitHub style is pretty nice. Try it. It is written in Node.js.

gfm

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Gabriel Llamas
  • 18,244
  • 26
  • 87
  • 112