Identifying meta-data structure of Posts for Front-End Implementation

in #data3 years ago

Every post you make on HIVE is stored as data on the public blockchain. Interestingly, this data is basically plain-text, which means it consists of just characters. From a formatting perspective, this means that additional information (or metadata) is required. If you want to make a section of your post bold then there must be something included with it in the plain-text data to indicate that it should be formatted as bold when displayed on a front-end interface. This article is meant to provide exploration into the metadata information that is included on the HIVE blockchain for a post that front-end interfaces such as peakd use to display the post with specific formatting.

Specifically, I'm making this post to try to find every specific aspect that peakd uses for formatting so that I can have a reference "dictionary" to utilize when parsing the post data directly from the HIVE Blockchain.

What would happen if we did not define rules for parsing the formatting data directly from the blockchain? Total destruction Our interface would display all of the additional "instructional" characters as they are, so something that should display as bold would instead display as **bold** (this line actually provides a good exercise, as I manually backslashed the * characters in an effort to prevent them from formatting as bold - we will see how it displays on the blockchain)

Why is identifying post metadata important?

  1. Learning is always beneficial.
  • Matching formatting rules ensures consistency between front-end interfaces
    1. It also allows for custom-formatting for front-end interfaces
      It'll give you super powers.

So far I have this much:

formatcharacter
bold**
subscript<sub>

There also appears to be more formatting rules that peakd is not showing with their editor directly. When I view certain posts such as this recipe: https://hiveblocks.com/tx/26e9f05bdedc1caeaabfa4bf28f56b8776c15ac6
I see data instructions for centering, justification, and even bottom-borders.

formatcharacter
center<center>
justify<div class="text-justify">
border---------

Let's try them out:

Is this now centered?

Is this multi-line paragraph justified? I.E. does each line align itself to match the width of all of the other lines within the container? Or does the text match the formatting of above where the right side of each line has varying widths?

Is there a bottom border after this line?

It is interesting to note that some of the formatting uses HTML syntax, whereas others do not. Additionally, certain HTML elements are not allowed (and rightfully so) such as the <script> tags, so it will be interesting to create a list of what is and is not allowed.

From a utility perspective, this would be a necessary implementation for a system that syndicates content from the blockchain into other formats, such as a utility that stores article data on HIVE but additionally displays the information in the form of a blog on a Wordpress site.

I think I've included enough formatting elements for personal use for now, and I can always view the raw data for other posts as well if I ever find more that contain additional formatting rules. If you happen to come across this post let me know if it was helpful! Otherwise, I'll be viewing it on the code-end of a streamed block and using it to start a dictionary for HIVE post formatting rules.
-Ace