You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A number for how many characters long URLs/emails/Twitter handles/Twitter
106
106
hashtags should be truncated to inside the text of a link. If the match is
107
107
over the number of characters, it will be truncated to this length by
108
108
replacing the end of the string with a two period ellipsis ('..').<br /><br />
109
+
109
110
Example: a url like 'http://www.yahoo.com/some/long/path/to/a/file' truncated
110
111
to 25 characters may look like this: 'yahoo.com/some/long/pat..'<br /><br />
112
+
113
+
In the object form, both `length` and `location` may be specified to perform
114
+
truncation. Available options for `location` are: 'end' (default), 'middle',
115
+
or 'smart'. Example usage:
116
+
117
+
```javascript
118
+
truncate: { length:32, location:'middle' }
119
+
```
120
+
121
+
The 'smart' truncation option is for URLs where the algorithm attempts to
122
+
strip out unnecessary parts of the URL (such as the 'www.', then URL scheme,
123
+
hash, etc.) before trying to find a good point to insert the ellipsis if it is
124
+
still too long. For details, see source code of: (TruncateSmart)[http://gregjacobs.github.io/Autolinker.js/gh-pages/docs/#!/api/Autolinker.truncate.TruncateSmart]
Copy file name to clipboardExpand all lines: src/Autolinker.js
+49-31Lines changed: 49 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,7 @@
102
102
* - An {@link Autolinker.HtmlTag} instance, which can be used to build/modify an HTML tag before writing out its HTML text.
103
103
*
104
104
* @constructor
105
-
* @param {Object} [config] The configuration options for the Autolinker instance, specified in an Object (map).
105
+
* @param {Object} [cfg] The configuration options for the Autolinker instance, specified in an Object (map).
106
106
*/
107
107
varAutolinker=function(cfg){
108
108
Autolinker.Util.assign(this,cfg);// assign the properties of `cfg` onto the Autolinker instance. Prototype properties will be used for missing configs.
0 commit comments