From d34f51a9d02069078a4b0e5a63c60a5eee1a7270 Mon Sep 17 00:00:00 2001 From: or-else Date: Thu, 24 Aug 2017 20:16:53 -0700 Subject: [PATCH] better formatted example --- drafty.js | 141 ++++++++---------------------------------------------- 1 file changed, 21 insertions(+), 120 deletions(-) diff --git a/drafty.js b/drafty.js index f8cbbe0e..3e5a118c 100644 --- a/drafty.js +++ b/drafty.js @@ -14,129 +14,30 @@ /* Text: - this is *bold*, `code` and _italic_, ~strike~ - combined *bold and _italic_* - an url: https://www.example.com/abc#fragment and another _www.tinode.co_ - this is a @mention and a #hashtag in a string - second #hashtag + this is *bold*, `code` and _italic_, ~strike~ + combined *bold and _italic_* + an url: https://www.example.com/abc#fragment and another _www.tinode.co_ + this is a @mention and a #hashtag in a string + second #hashtag Sample JSON representation of the text above: { - "txt":"this is bold, code and italic, strike combined bold and italic an url: https://www.example.com/abc#fragment " + - "and another www.tinode.co this is a @mention and a #hashtag in a string second #hashtag", - "fmt":[ - { - "at":8, - "len":4, - "tp":"ST" - }, - { - "at":14, - "len":4, - "tp":"CO" - }, - { - "at":23, - "len":6, - "tp":"EM" - }, - { - "at":31, - "len":6, - "tp":"DL" - }, - { - "tp":"BR", - "len":1, - "at":37 - }, - { - "at":56, - "len":6, - "tp":"EM" - }, - { - "at":47, - "len":15, - "tp":"ST" - }, - { - "tp":"BR", - "len":1, - "at":62 - }, - { - "at":120, - "len":13, - "tp":"EM" - }, - { - "at":71, - "len":36, - "key":0 - }, - { - "at":120, - "len":13, - "key":1 - }, - { - "tp":"BR", - "len":1, - "at":133 - }, - { - "at":144, - "len":8, - "key":2 - }, - { - "at":159, - "len":8, - "key":3 - }, - { - "tp":"BR", - "len":1, - "at":179 - }, - { - "at":187, - "len":8, - "key":3 - }, - { - "tp":"BR", - "len":1, - "at":195 - } - ], - "refs":[ - { - "tp":"LN", - "data":{ - "url":"https://www.example.com/abc#fragment" - } - }, - { - "tp":"LN", - "data":{ - "url":"http://www.tinode.co" - } - }, - { - "tp":"MN", - "data":{ - "val":"mention" - } - }, - { - "tp":"HT", - "data":{ - "val":"hashtag" - } - } - ] + "txt": "this is bold, code and italic, strike combined bold and italic an url: https://www.example.com/abc#fragment " + + "and another www.tinode.co this is a @mention and a #hashtag in a string second #hashtag", + "fmt": [ + { "at":8, "len":4,"tp":"ST" },{ "at":14, "len":4, "tp":"CO" },{ "at":23, "len":6, "tp":"EM"}, + { "at":31, "len":6, "tp":"DL" },{ "tp":"BR", "len":1, "at":37 },{ "at":56, "len":6, "tp":"EM" }, + { "at":47, "len":15, "tp":"ST" },{ "tp":"BR", "len":1, "at":62 },{ "at":120, "len":13, "tp":"EM" }, + { "at":71, "len":36, "key":0 },{ "at":120, "len":13, "key":1 },{ "tp":"BR", "len":1, "at":133 }, + { "at":144, "len":8, "key":2 },{ "at":159, "len":8, "key":3 },{ "tp":"BR", "len":1, "at":179 }, + { "at":187, "len":8, "key":3 },{ "tp":"BR", "len":1, "at":195 } + ], + "refs": [ + { "tp":"LN", "data":{ "url":"https://www.example.com/abc#fragment" } }, + { "tp":"LN", "data":{ "url":"http://www.tinode.co" } }, + { "tp":"MN", "data":{ "val":"mention" } }, + { "tp":"HT", "data":{ "val":"hashtag" } } + ] } */