I was looking for a way to print a markdown file from command line. I usually use lp
for simple text files; I want to use something like that, but for markdown.
Also it would be great that this printing could take care of hyphenation (my actual approach to this does not).
In a more general way it would be fantastic to print many more types of files from command line.
Edit: Notice that it's possible to add a mime type to the lp
command. For example:
lp -o document-format=text/x-markdown file.md
Of course the problem with this is that the my printing system (cups) doesn't allow this type of document.
Solution: A friend told me about a way to accomplish this. A series of pipes.
markdown file.md
-> .md to .html
iconv -f utf-8 -t iso-8859-1
-> utf-8 to iso-8859-1
html2ps
-> html to postscript
lp
-> print
Finally
markdown file.md | iconv -f utf-8 -t iso-8859-1 | html2ps | lp
Does the trick
The bad: This does not accomplish the hyphenation part (at least I don't think so). My friend told me that in order to accomplish this is better to use pandoc
to convert a file from markdown to LaTeX and then print that.