Introducing Markup builder: minimalist but powerful HTML and Markdown markup builder by dzivenu

View this thread on steempeak.com
· @dzivenu · (edited)
$13.52
Introducing Markup builder: minimalist but powerful HTML and Markdown markup builder
![image](https://cdn.steemitimages.com/DQmNTmAzVe52SPyofE26tQkQy7gYupQysEoUoyPKEmgCpw3/code-1839406_1280.jpg)

Meet Markup builder, a minimal powerful utility for building markup, be it HTML or Markdown. 

This library can help you transform your markup by sanitizing against XSS, converting markdown to HTML and more. It is built on [XSS](https://www.npmjs.com/package/xss), [Remarkable](https://www.npmjs.com/package/remarkable), [DOMParser](https://www.npmjs.com/package/dom-parser) and [Markup tools](https://www.npmjs.com/package/markup-tools).

### How do you use Markup builder?

**Node.js**

```
npm install markup-builder --save
```

Use as:

```
const markup = require('markup-builder');
```

**Browser**
`https://unpkg.com/markup-builder/dist/markup.min.js`
Exported to the browser window as `markup`.

### Using markup builder
```
const t = "**Lorem ipsum dolor sit amet**, consectetuer adipiscing elit. Aenean <i>commodo ligula eget</i> dolor. Aenean massa. Cum @sociis natoque #penatibus et magnis dis parturient montes,<script>alert('Quisque rutrum.')</script> nascetur ridiculus mus. Donec quam felis, https://www.youtube.com/watch?v=sO_YEdTcVXc https://travis-ci.org/peerquery/markup-builder";

//inside async function
var content = await markup.build.content(t /*,config, options*/ );   //with about options object
console.log(content);
 
//With promise API
markup.build.content(t /*,config, options*/).then(function(content){   //options is optional, using defaults
    console.log(content);
});
 
// "<p><strong>Lorem ipsum dolor sit amet</strong>, consectetuer adipiscing elit. Aenean <i>commodo ligula eget</i> dolor. Aenean massa. Cum <a target="_blank" href="/user/sociis">@sociis</a> natoque <a target="_blank" href="/trending/penatibus "> #penatibus </a> et magnis dis parturient montes,&lt;script&gt;alert(\'Quisque rutrum.\')&lt;/script&gt; nascetur ridiculus mus. Donec quam felis, <a href="https://www.youtube.com/watch?v=sO_YEdTcVXc">https://www.youtube.com/watch?v=sO_YEdTcVXc</a> <a href="https://travis-ci.org/peerquery/markup-builder">https://travis-ci.org/peerquery/markup-builder</p></a>\n"
```

### How is Markup builder different from Markup tools?

[Markup tools](https://www.npmjs.com/package/markup-tools)&nbsp;is a small set of standalone utilities for basic text manipulation. However Markup builder allows you to actually build markup.

[Markup builder](https://www.npmjs.com/package/markup-builder)'s build functions use Markup tools to build all un-attached hashtags into hyperlinked tags, all un-attached mentions into hyperlinked mentions, as well as build all raw urls and image links into their respective tags.

In addition to this markup is also sanitized, and markdown is converted to HTML.

### Resources and links

Github repo:&nbsp;[https://github.com/peerquery/markup-builder](https://github.com/peerquery/markup-builder)

NPM page:&nbsp;[https://www.npmjs.com/package/markup-builder](https://www.npmjs.com/package/markup-builder)  

- - -

  Published on [Peer Query - Blockchain-powered p2p collaboration](http://www.peerquery.com/report/dzivenu-introducing-markup-builder-minimalist-but-powerful-html-and-markdown-markup-builder-jnagdv4aux0yt).
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 84 others
properties (23)
post_id64,298,960
authordzivenu
permlinkdzivenu-introducing-markup-builder-minimalist-but-powerful-html-and-markdown-markup-builder-jnagdv4aux0yt
categoryutopian-io
json_metadata{"image":["https:\/\/cdn.steemitimages.com\/DQmNTmAzVe52SPyofE26tQkQy7gYupQysEoUoyPKEmgCpw3\/code-1839406_1280.jpg"],"links":["https:\/\/www.npmjs.com\/package\/xss","https:\/\/www.npmjs.com\/package\/remarkable","https:\/\/www.npmjs.com\/package\/dom-parser","https:\/\/www.npmjs.com\/package\/markup-tools","https:\/\/www.npmjs.com\/package\/markup-builder","https:\/\/github.com\/peerquery\/markup-builder","http:\/\/www.peerquery.com\/report\/dzivenu-introducing-markup-builder-minimalist-but-powerful-html-and-markdown-markup-builder-jnagdv4aux0yt"],"format":"markdown","app":"steemit\/0.1","tags":["utopian-io","blog","news","dev"]}
created2018-10-15 15:29:12
last_update2018-10-15 15:34:24
depth0
children5
net_rshares10,725,553,378,337
last_payout2018-10-22 15:29:12
cashout_time1969-12-31 23:59:59
total_payout_value10.341 SBD
curator_payout_value3.177 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length3,240
author_reputation35,120,084,774,494
root_title"Introducing Markup builder: minimalist but powerful HTML and Markdown markup builder"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (148)
@didic ·
$5.82
This is very similar to your previous post: It's the sort of post I'd like to see go into much more detail. I would have liked to know why you decided to make this, why you made the decisions you made while making this. 

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/1/23414313).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , ,
properties (23)
post_id64,320,446
authordidic
permlinkre-dzivenu-dzivenu-introducing-markup-builder-minimalist-but-powerful-html-and-markdown-markup-builder-jnagdv4aux0yt-20181015t233029432z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https:\/\/join.utopian.io\/guidelines","https:\/\/review.utopian.io\/result\/1\/23414313","https:\/\/support.utopian.io\/","https:\/\/discord.gg\/uTyJkNm","https:\/\/join.utopian.io\/"],"app":"steemit\/0.1"}
created2018-10-15 23:30:30
last_update2018-10-15 23:30:30
depth1
children2
net_rshares4,619,792,926,330
last_payout2018-10-22 23:30:30
cashout_time1969-12-31 23:59:59
total_payout_value4.409 SBD
curator_payout_value1.410 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length712
author_reputation76,442,227,425,259
root_title"Introducing Markup builder: minimalist but powerful HTML and Markdown markup builder"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (12)
@dzivenu · (edited)
before i begin let me thank you and utopian for your support, i appreciate it alot

sorry for the brief submission, i am a little late on schedule and rushed things. basically, there are two different libraries, markup-tools for basic manipulations while markup-builder does absolute markup processing

these two libraries are great for handling Steem based markup as they process markup which is sometimes a mix of HTML and Markdown, they also sanitize markup against XSS, while building raw youtube urls into iframes, raw image links into img tags, raw mentions and hashtags into hyperlinked entities and more

they basically handle all the complete parsing, transformations, building  and sanitizations of markup so you can just plug it into your project and play. they are also fully customizable giving the developer complete control of the resulting markup

they work in both browser and node.js, making them very compact. i am using them on peer query and they will be integrated into curator and adom and other projects. i believe the community could benefit from them

the difference between the two is: markup-tools is standalone and dependency free, does powerful text parsing, and building of HTML markup. however markup-builder offers a complete solution including markdown conversion, sanitizing and more. actually, markup-builder uses markup-tool as a dependency
properties (22)
post_id64,324,122
authordzivenu
permlinkre-didic-re-dzivenu-dzivenu-introducing-markup-builder-minimalist-but-powerful-html-and-markdown-markup-builder-jnagdv4aux0yt-20181016t010900799z
categoryutopian-io
json_metadata{"app":"steemit\/0.1","tags":["utopian-io"]}
created2018-10-16 01:09:57
last_update2018-10-16 01:11:45
depth2
children0
net_rshares0
last_payout2018-10-23 01:09:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,377
author_reputation35,120,084,774,494
root_title"Introducing Markup builder: minimalist but powerful HTML and Markdown markup builder"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
Thank you for your review, @didic!

So far this week you've reviewed 14 contributions. Keep up the good work!
properties (22)
post_id64,624,577
authorutopian-io
permlinkre-re-dzivenu-dzivenu-introducing-markup-builder-minimalist-but-powerful-html-and-markdown-markup-builder-jnagdv4aux0yt-20181015t233029432z-20181020t233021z
categoryutopian-io
json_metadata{"app":"beem\/0.20.1"}
created2018-10-20 23:30:24
last_update2018-10-20 23:30:24
depth2
children0
net_rshares0
last_payout2018-10-27 23:30:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length109
author_reputation152,913,012,544,965
root_title"Introducing Markup builder: minimalist but powerful HTML and Markdown markup builder"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steem-ua ·
$0.02
#### Hi @dzivenu!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
πŸ‘  
properties (23)
post_id64,320,980
authorsteem-ua
permlinkre-dzivenu-introducing-markup-builder-minimalist-but-powerful-html-and-markdown-markup-builder-jnagdv4aux0yt-20181015t234454z
categoryutopian-io
json_metadata{"app":"beem\/0.20.7"}
created2018-10-15 23:44:54
last_update2018-10-15 23:44:54
depth1
children0
net_rshares19,031,017,038
last_payout2018-10-22 23:44:54
cashout_time1969-12-31 23:59:59
total_payout_value0.016 SBD
curator_payout_value0.005 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length286
author_reputation23,203,609,903,979
root_title"Introducing Markup builder: minimalist but powerful HTML and Markdown markup builder"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@utopian-io ·
Hey, @dzivenu!

**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
post_id64,686,072
authorutopian-io
permlinkre-dzivenu-introducing-markup-builder-minimalist-but-powerful-html-and-markdown-markup-builder-jnagdv4aux0yt-20181022t023012z
categoryutopian-io
json_metadata{"app":"beem\/0.20.1"}
created2018-10-22 02:30:12
last_update2018-10-22 02:30:12
depth1
children0
net_rshares0
last_payout2018-10-29 02:30:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length589
author_reputation152,913,012,544,965
root_title"Introducing Markup builder: minimalist but powerful HTML and Markdown markup builder"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000