Posts Tagged ‘markdown’

You can open a markdown (.md) file in Okular

November 29, 2018 Leave a comment

Today I found out by accident that you can open a markdown file (.md) with okular. okular was just a PDF viewer for me. The .md file is nicely rendered and you can convert it to PDF or you can print it. Awesome!

Categories: linux Tags: , , , ,

Remarkable: a nice markdown editor with live preview

December 3, 2014 1 comment

Update (20150820): I found a better solution. Check out the last update at the end of this post.

At last a cool markdown editor with live preview. Check it out here:


I read about it here:

Open .md files with Midnight Commander

# markdown
    Open=remarkable %f 1>/dev/null 2>&1 &
Categories: Uncategorized Tags: ,

Powerpoint is dead (HTML5 presentations with landslide)

September 23, 2011 1 comment

Powerpoint is dead. Well, not yet, but for simple presentations you can use the following tool perfectly. This entry is based on Francisco Souza’s excellent post entitled “Creating HTML 5 slide presentations using landslide“. Here I make a short summary.

Landslide is a Python tool for converting marked-up texts to HTML5 slide presentations. The input text can be written in Markdown, reStructuredText, or Textile. A sample slideshow presenting landslide itself is here.

Sample input: (taken from the landslide project)
Sample output: presentation.html


sudo pip install landslide



If you want to share it on the Internet: “landslide -cr“.

Help: “landslide --help“.

To learn about the customization of the theme, refer to Francisco’s post.

Convert to PDF

landslide -d out.pdf

For this you need Prince XML, which is free for non-commercial use. Unfortunately the output is black and white with additional blank pages for notes. If you know how to have colored PDFs without the extra pages, let me know.

It’d be interesting to replace Prince XML with wkhtmltopdf. I made some tests but the output was not nice. I think it could be tweaked though.

Related stuff

Pandoc is a universal document converter.

If you need to convert files from one markup format into another, pandoc is your swiss-army knife. Need to generate a man page from a markdown file? No problem. LaTeX to Docbook? Sure. HTML to MediaWiki? Yes, that too. Pandoc can read markdown and (subsets of) reStructuredText, textile, HTML, and LaTeX, and it can write plain text, markdown, reStructuredText, HTML, LaTeX, ConTeXt, PDF, RTF, DocBook XML, OpenDocument XML, ODT, GNU Texinfo, MediaWiki markup, textile, groff man pages, Emacs org-mode, EPUB ebooks, and S5 and Slidy HTML slide shows. PDF output (via LaTeX) is also supported with the included markdown2pdf wrapper script.

Installing the Ruby Version Manager and some gems


I wanted to try the Ruby script redcarpet. Since I’ve never used Ruby, I had serious problems with installing it… Fortunately ndbroadbent gave me a hand and provided a step-by-step description how to get it done. So here is what I learned.


The “easiest” way is to install RVM, the Ruby Version Manager. RVM lets you run multiple versions of Ruby, and each Ruby can set up its own environment. RVM facilitates the installation of gems and takes care of all the PATH and GEM_HOME stuff automatically. Note that if you ever need to install any more gems, don’t use sudo anymore. Just run ‘gem install <gem_name>‘.

Installing RVM and the redcarpet gem ($ is the prompt):

$ bash < # the installer added this line to ~/.bash_profile:
# [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# let's source it:
$ source ~/.bash_profile
$ rvm install 1.8.7
$ rvm use --default 1.8.7
$ gem install redcarpet

Now you should be able to run redcarpet, which is a Ruby interface to the upskirt library, the library that is used at GitHub to render markdown texts.

You can use the “markdown” command, which is the classical implementation of the markdown “language”, or you can also use the upskirt project, which is the reference implementation of the GitHub flavored markdown. Redcarpet is just a wrapper around upskirt.

Update: there is also a Python wrapper for upskirt called pantyshot.

README.markdown on GitHub

May 5, 2011 12 comments

For a quick and painless solution check out the last update at the end of the post.

When you create a project on GitHub, it is highly encouraged to add a README file too. Thus, when someone visits your project’s page, they will see the content of your README file automatically (example).

If you want, you can use the markdown syntax in your README files. In this case don’t forget to rename the file to README.markdown. It has the advantage that the output is much nicer while the source remains readable in a normal text editor too (example).

Update: You can also name the file as In the future I’ll use the .md extension, it’s shorter and simpler.

To learn more about the markdown syntax, refer to these links:


When I write a README.markdown file, I’d like to visualize it before uploading to GitHub. If there is a problem, I don’t want to commit this file several times. I’d like to refine it on my local machine and when it’s good, I want to upload it once.


I came up with the following Python script to visualize marked up files:

import os
import sys

MARKDOWN = 'markdown'
UPSKIRT = 'upskirt'


def main():
    update = False

    if len(sys.argv) &lt; 2:
        print "Usage: {0} &lt;file.markdown&gt; [-u]".format(sys.argv[0])
    # else
    if '-u' in sys.argv:
        update = True
    input_file = sys.argv[1]
    os.system("{program} {input} &gt; /tmp/markdown.html".format(program=PROGRAM, input=input_file))
    if not update:
        os.system("chromium-browser /tmp/markdown.html &")
    if VERBOSE:
        print &gt;&gt;sys.stderr, "# renderer: {0}".format(PROGRAM)


if __name__ == "__main__":

The up-to-date version of the script is available in this GitHub repository.

Usage: put it in your ~/bin directory (make sure ~/bin is in your PATH), make it executable (chmod u+x ~/bin/, and call it as “ README.markdown“. It will open the HTML output in a new tab. Adding the “-u” switch (update), the HTML is not opened in the browser.

Typical usage: call it first as “ README.markdown“, then add the “-u” switch and refresh the output in the browser.

Ref.: I saw this idea here but I couldn’t make it work with Ruby. I added the “-u” switch to make it easier to use.

Update (20110507)

First, I managed to install redcarpet. It was not easy… I wrote a post about it.

Second, if you want to use the GitHub flavored markdown, you don’t need to install redcarpet. I figured out later that redcarpet is just a Ruby wrapper for upskirt. So you can use upskirt directly. It’s written in C, just compile it and use the executable binary “upskirt“. This is integrated in the new version of the script (available here).

Update (20120212)
The “upskirt” project is gone from Github. It is replaced by sundown. Sundown is a fork of upskirt and this is the version used by Github too.

Update (20120219)
As it was pointed out by Teodor in a comment, the easiest way is to use the text editor ReText. It has a live preview function (Ctrl+Shift+E), thus editing Markdown or reStructuredTexts is made trivial. ReText is written in Python by the way.

Update (20141203)
I found an even nicer editor for markdown files: Remarkable. I write about it here.

Update (20150820)
Here is the ultimate solution :) Use the Atom editor with the markdown-preview package. Open a rendered version of the Markdown in the current editor with “Ctrl-Shift-M”.