Public
Authored by Conrad Ferdinand Albers

Shell script for converting markdown files to textile files correctly

md2textile

This file uses pandoc and ruby to convert a file from markdown to textile and correctly handles code blocks for Redmine.

Usage

./md2textile.sh infile outfile

Download

md2textile.sh

Code

#! /bin/bash

cat $1 | ruby -pe 'puts " "*20 if $_.match("^```$")' \
  | pandoc -f markdown -t textile \
  | ruby -r cgi -n -e 'print CGI.unescapeHTML($_);' \
  | ruby -ne 'puts $_ unless $_.match(" "*20)' \
  > $2
Edited
13 Bytes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment