Skip to content

Commit 329b16e

Browse files
committed
Add tiktok mentions
1 parent 4a70513 commit 329b16e

19 files changed

+117
-48
lines changed

dist/Autolinker.js

Lines changed: 10 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/Autolinker.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/Autolinker.min.js

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/Autolinker.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ <h3>Others...</h3>
8888

8989

9090

91-
<div id='footer-content' style='display: none'>Generated on Fri 25 Feb 2022 15:18:32 by <a href='https://github.com/senchalabs/jsduck'>JSDuck</a> 5.3.4.</div>
91+
<div id='footer-content' style='display: none'>Generated on Sun 27 Feb 2022 11:28:05 by <a href='https://github.com/senchalabs/jsduck'>JSDuck</a> 5.3.4.</div>
9292

9393

9494

docs/api/output/Autolinker.matcher.Mention.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/output/global.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/source/Autolinker.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,13 @@
427427
this.sanitizeHtml = cfg.sanitizeHtml || false;
428428
// Validate the value of the `mention` cfg
429429
var mention = this.mention;
430-
if (mention !== false &amp;&amp; mention !== &#39;twitter&#39; &amp;&amp; mention !== &#39;instagram&#39; &amp;&amp; mention !== &#39;soundcloud&#39;) {
431-
throw new Error(&quot;invalid `mention` cfg - see docs&quot;);
430+
if (mention !== false &amp;&amp; [&#39;twitter&#39;, &#39;instagram&#39;, &#39;soundcloud&#39;, &#39;tiktok&#39;].indexOf(mention) === -1) {
431+
throw new Error(&quot;invalid `mention` cfg &#39;&quot;.concat(mention, &quot;&#39; - see docs&quot;));
432432
}
433433
// Validate the value of the `hashtag` cfg
434434
var hashtag = this.hashtag;
435-
if (hashtag !== false &amp;&amp; hashtag !== &#39;twitter&#39; &amp;&amp; hashtag !== &#39;facebook&#39; &amp;&amp; hashtag !== &#39;instagram&#39;) {
436-
throw new Error(&quot;invalid `hashtag` cfg - see docs&quot;);
435+
if (hashtag !== false &amp;&amp; [&#39;twitter&#39;, &#39;facebook&#39;, &#39;instagram&#39;, &#39;tiktok&#39;].indexOf(hashtag) === -1) {
436+
throw new Error(&quot;invalid `hashtag` cfg &#39;&quot;.concat(hashtag, &quot;&#39; - see docs&quot;));
437437
}
438438
this.truncate = this.normalizeTruncateCfg(cfg.truncate);
439439
this.className = cfg.className || this.className;

docs/api/source/mention-matcher.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
var twitterRegex = new RegExp(&quot;@[_&quot;.concat(regex_lib_1.alphaNumericAndMarksCharsStr, &quot;]{1,50}(?![_&quot;).concat(regex_lib_1.alphaNumericAndMarksCharsStr, &quot;])&quot;), &#39;g&#39;); // lookahead used to make sure we don&#39;t match something above 50 characters
3131
var instagramRegex = new RegExp(&quot;@[_.&quot;.concat(regex_lib_1.alphaNumericAndMarksCharsStr, &quot;]{1,30}(?![_&quot;).concat(regex_lib_1.alphaNumericAndMarksCharsStr, &quot;])&quot;), &#39;g&#39;); // lookahead used to make sure we don&#39;t match something above 30 characters
3232
var soundcloudRegex = new RegExp(&quot;@[-_.&quot;.concat(regex_lib_1.alphaNumericAndMarksCharsStr, &quot;]{1,50}(?![-_&quot;).concat(regex_lib_1.alphaNumericAndMarksCharsStr, &quot;])&quot;), &#39;g&#39;); // lookahead used to make sure we don&#39;t match something above 50 characters
33+
// TikTok usernames are 1-24 characters containing letters, numbers, underscores
34+
// and periods, but cannot end in a period: https://support.tiktok.com/en/getting-started/setting-up-your-profile/changing-your-username
35+
var tiktokRegex = new RegExp(&quot;@[_.&quot;.concat(regex_lib_1.alphaNumericAndMarksCharsStr, &quot;]{1,23}[_&quot;).concat(regex_lib_1.alphaNumericAndMarksCharsStr, &quot;](?![_&quot;).concat(regex_lib_1.alphaNumericAndMarksCharsStr, &quot;])&quot;), &#39;g&#39;); // lookahead used to make sure we don&#39;t match something above 24 characters
3336
var nonWordCharRegex = new RegExp(&#39;[^&#39; + regex_lib_1.alphaNumericAndMarksCharsStr + &#39;]&#39;);
3437
<span id='Autolinker-matcher-Mention'>/**
3538
</span> * @class Autolinker.matcher.Mention
@@ -51,7 +54,7 @@
5154
*
5255
* The name of service to link @mentions to.
5356
*
54-
* Valid values are: &#39;twitter&#39;, &#39;instagram&#39;, or &#39;soundcloud&#39;
57+
* Valid values are: &#39;twitter&#39;, &#39;instagram&#39;, &#39;soundcloud&#39;, or &#39;tiktok&#39;
5558
*/
5659
_this.serviceName = &#39;twitter&#39;; // default value just to get the above doc comment in the ES5 output and documentation generator
5760
<span id='Autolinker-matcher-Mention-property-matcherRegexes'> /**
@@ -65,7 +68,8 @@
6568
_this.matcherRegexes = {
6669
&#39;twitter&#39;: twitterRegex,
6770
&#39;instagram&#39;: instagramRegex,
68-
&#39;soundcloud&#39;: soundcloudRegex
71+
&#39;soundcloud&#39;: soundcloudRegex,
72+
&#39;tiktok&#39;: tiktokRegex
6973
};
7074
<span id='Autolinker-matcher-Mention-property-nonWordCharRegex'> /**
7175
</span> * The regular expression to use to check the character before a username match to

docs/dist/Autolinker.js

Lines changed: 10 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)