Skip to content

Commit

Permalink
Refactor Twitter username formatting in formatMarkdown.js
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangsvit committed Jan 31, 2024
1 parent ff479e2 commit bc6297b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/helper/markdown/format_markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ let formatMarkdown = function () {
if(twitterUsername === 'undefined value'){
return `No Twitter Username`;
} else {
twitterUsername = twitterUsername.replace(/[{}]/g, '');
twitterUsername = twitterUsername.replace(/<[^>]*>/g, '');
twitterUsername = twitterUsername.replace(/[^\w\s]/gi, ''); // Remove special characters
return `<a href="https://twitter.com/${twitterUsername}">${twitterUsername}</a>`
}
}
Expand Down

0 comments on commit bc6297b

Please sign in to comment.