Make and display HTML from md

November 24, 2021 - Reading time: ~1 minute

Markdown is a basic markup language used to format text written using a text editor.
Here is a useful cheat-sheet I'm using while writing this post: cheat-sheet

To convert the .md file into .html I'm using showdown, specifically the CLI tool.
Once installed, create the following function on your ~/.bashrc:

# Function to create html from markdown 
# requires https://github.com/showdownjs/showdown/wiki/CLI-tool
makehtml() { 
  \rm out.html ; 
  showdown makehtml -mi $1 -o out.html ; 
  echo "<style>code { color : darkblue; background-color : beige ; } html { width: 60%;margin-left: 100px;margin-right: 100px; }</style>" >> out.html
  firefox-esr ./out.html 
}