Writing in HTML isn’t that cool
I have written my whole web in HTML line by line, or in other words, I have not used any framework. Writing a blog in this language is not very convenient. That is why I have created a little bash script that converts Markdown files (one per blog entry) to HTML and automagically integrates them on the web.
For those who don’t know what markdown is, it’s a language for writing documents with format (different level headers, bold, italic, tables, graphs…) in a very simple way. Any simple plain text processor is enough to begin create a Markdown file.
Markdown demonstration
Below you can see how this paragraph is written in Markdown format. Here you have more information on what you can do with it.
#### Markdown demonstration
**Below** you can see how this paragraph is written in Markdown format. [Here](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) you have more information on what you can do with it.
How the automation works
The script must be executed every time an HTML template has been modified, or a new Markdown file (new entry) is created. Currently the script is placed at blog/convert.sh
, HTML templates in blog/templates
and .md
(Markdown) files in blog/md
. When the script is executed, the following files are generated:
blog/index.html
: blog index page, containing a link to every entry.blog/entry_id.html
: entry page containing an HTML version of the fileblog/md/entry_id.html
. This occurs for every.md
file insideblog/md
folder.
As you may have noticed, every blog entry has associated an icon that is shown at the index and in the entry itself. This information as well as date of publication and modification and title of the entry are declared at the beginning of the .md
file following this structure:
<!--name:About this website-->
<!--pubdate:2020/07/09-->
<!--moddate:2020/07/10-->
<!--icon:web-->
With this functionality, I do not have to deal with HTML code at all in order to post a new entry. Everything is done in the .md
file.
Source code
Just like my whole website, you can find the source code of this script and the folder containing all my blog entries in .md
format in my Github repository.
Published: 2020/07/13
Modified: 2020/07/13