Description
Truncation works just fine, but the only place where I found the truncated text inside the match object was in match.buildTag().innerHTML, the link in .getAnchorText() isn't truncated.
Based on the source code, it happens because truncation is performed only inside the tagBulder, so in my case (I wanted to process matches manually, with custom safety checks) it wasn't performed at all.
Steps to reproduce
const matches = Autolinker.parse("https://www.example.com/some-very-long-link/with/a/long/path", {truncate: 20});
- There is no truncated link inside the
match object. The link inside match.buildTag().innerHTML requires substring replacement:
match.buildTag().innerHTML.replace("…", "...")
Description
Truncation works just fine, but the only place where I found the truncated text inside the match object was in
match.buildTag().innerHTML, the link in.getAnchorText()isn't truncated.Based on the source code, it happens because truncation is performed only inside the
tagBulder, so in my case (I wanted to process matches manually, with custom safety checks) it wasn't performed at all.Steps to reproduce
const matches = Autolinker.parse("https://www.example.com/some-very-long-link/with/a/long/path", {truncate: 20});matchobject. The link insidematch.buildTag().innerHTMLrequires substring replacement: