By vadim
Let's test Google Doc together!
This thread is an example of potentially all combinations of text
Table of Contents
The original Google Document is located here . Edit it to publish changes on Holdex threads.
Quotes
Plan is nothing, planning is everything!
We look forward to hosting the best Web3 teams from across the world in the Bahamas in January. This is a great opportunity for scale-ups to pitch in front of VCs and more than 3,000 industry professionals – Anthony Sar, CEO at Finoverse.
Links
Single link element
This link must be a plain text in Google doc
- { - "endIndex" : 47, - "startIndex" : 28, - "textRun" : { - "content" : "\u000b holdex.io\n", - "textStyle" : { - - } - } - } - ], - "paragraphStyle" : { - "direction" : "LEFT_TO_RIGHT", - "namedStyleType" : "NORMAL_TEXT" - } - }
- },
- { - "paragraph" : { - "elements" : [ - { - "textRun" : { - "textStyle" : { - - }, - "content" : "\n" - }, - "startIndex" : 47, - "endIndex" : 48 - } - ], - "paragraphStyle" : { - "namedStyleType" : "NORMAL_TEXT", - "direction" : "LEFT_TO_RIGHT" - } - }, - "startIndex" : 47, - "endIndex" : 48
- },
With custom text anchor
Link must be surrounded by text, otherwise it will be rendered as Rich Snippet
Example of the link
Rich snippet
Example 1
" paragraph ": {
" elements ": [{
"textRun": {
"content": "Hyperlink",
"textStyle": {
"foregroundColor": {
"color": {
"rgbColor": {
"blue": 0.8,
"red": 0.06666667,
"green": 0.33333334
}
}
},
"underline": true,
"link": {
"url": " holdex.io"
}
}
},
"startIndex": 1,
"endIndex": 10
}, {
"startIndex": 10,
"endIndex": 11,
"textRun": {
"content": "\n",
"textStyle": {}
}
}],
"paragraphStyle": {
"direction": "LEFT_TO_RIGHT",
"namedStyleType": "NORMAL_TEXT"
}
}
Example 2
- { "endIndex" : 47,
- "startIndex" : 11,
- "paragraph" : { - "elements" : [ - { - "textRun" : { - "content" : " holdex.io", - "textStyle" : { - "foregroundColor" : { - "color" : { - "rgbColor" : { - "blue" : 0.8, - "red" : 0.06666667, - "green" : 0.33333334 - } - } - }, - "link" : { - "url" : " holdex.io" - }, - "underline" : true - } - }, - "startIndex" : 11, - "endIndex" : 28 - }, -
Proposed algorithm to handle links rendering
```if (paragraph.elements.length == 2 && paragraph.elements[1].textRun.content == “\n”)
then isSingleElement = true
if (isSingleElement == true && typeof paragraph.elements[0].textRun.textStyle.link !== “undefined”)
then isSimpleLink = true
if (isSimpleLink == true)
then renderAsSimpleLink() else
if stringHasSpace(paragraph.elements[0].textRun.content == true)
then isNotWidget == true
if (isSingleElement == true && isSimpleLink == false && isNotWidget == false)
Then runRegExToDeFineTypeOfWidget_for_Example_RichLink_or_Youtube
```
Use the `Export document` feature to copy the json.
www.freeformatter.com/json-esc... -> Unescape JSON