4.0.8 • Published 9 years ago
tik-attributed-text v4.0.8
tik-attributed-text

Encodes and decodes TikApi::v5 text attributes to HTML
Install
$ npm install --save tik-attributed-text
Usage
Below is a example of usage.
var attrsTextToHTML = require('tik-attributed-text/to-html');
attrsTextToHTML("Hello World!", [
{
_type: "Tik::ApiModel::Text::BoldSpan",
start: 2,
end: 6
},
{
_type: "Tik::ApiModel::Text::ItalicSpan",
start: 4,
end: 8
}
]); // => "He<strong>ll<em>o </em></strong><em>Wo</em>rld!"
HTMLtoAttrs("He<strong>ll<em>o</em></strong><em> Wo</em>rld!"); /* => {
text: "Hello World!",
attrs: [
{ _type: 'Tik::ApiModel::Text::BoldSpan', start: 2, end: 6 },
{ _type: 'Tik::ApiModel::Text::ItalicSpan', start: 4, end: 8 }
]
}*/
Options
to-attrs:
replaceBrTagWithNewLine
default: false
replaces <br>
tags with new lines \n
to-html:
proxyDocument
default: undefined
(Browser document)
if you want to run this function in a browserless environment like node
skipIntersectionsCompress
default: false
if you want to skip intersections normalization
replaceNewLinesWithBrTag
default: false
replaces new lines \n
with <br>
tags
4.0.8
9 years ago
4.0.7
10 years ago
4.0.6
10 years ago
4.0.4
10 years ago
4.0.3
10 years ago
4.0.1
10 years ago
4.0.0
10 years ago
3.0.0
10 years ago
2.0.2
10 years ago
2.0.1
10 years ago
2.0.0
10 years ago
1.0.8
10 years ago
1.0.7
10 years ago
1.0.6
10 years ago
1.0.5
10 years ago
1.0.4
10 years ago
1.0.3
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago