Journal/Microblog: Turn a markdown file into something like YAML

Hi guys!

A client of mine is keeping a journal and we want to make it available online using Hugo.

This is the desired and already used format.

# 2019-12-21

Text in *Markdown format.*

#tag1 #tag2

# 2019-12-20

Another post.


#tag1 #tag3

And this is the desired output format:

    <p>Text in <em>Markdown format.</em></p>
      <li><a href="/tags/tag1">tag1</a></li>
      <li><a href="/tags/tag1">tag2</a></li>
    <p>Another post.</p>
    <p><img src="image1.jpg"></p>
      <li><a href="/tags/tag1">tag1</a></li>
      <li><a href="/tags/tag3">tag3</a></li>

Any ideas how to treat the .md file almost as if it were a YAML file and e.g. turn # YYYY-MM-DD into a heading? (Tags might be the most complicated part. But it’s ok to just recognise without linking them.)

Thanks you very much in advance.

This “Journal” you are referring to is not maybe done with RedNotebook? The markup looks a lot like it. That program has a proper HTML export, so using Hugo might be overkill.

Thank you very much. I did not know the RedNotebook format.

using Hugo might be overkill.

The micro blog will be part of an existing Hugo project. It would be easily possible to just publish the .md ‘as is’ so it would be generated as a html file. That’s probably what RedNotebook does.

My aim is to automatically transform the file into a YAML file. Hugo will be able to create single pages from a big YAML file. So you have one page with all micro posts/tweets and—later—many single pages for each tweet.

As we use Hugo locally only a solution might be to use a bash script with regex?!

Thanks again!