@ecency/render-helper 2.2.5 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -865,6 +865,18 @@ describe('Markdown2Html', () => {
|
|
|
865
865
|
|
|
866
866
|
expect(markdown2Html(input)).toBe(expected)
|
|
867
867
|
})
|
|
868
|
+
|
|
869
|
+
it('64 - Should username with section link', () => {
|
|
870
|
+
const input = {
|
|
871
|
+
author: 'foo364',
|
|
872
|
+
permlink: 'bar364',
|
|
873
|
+
last_update: '2021-10-23T09:15:21',
|
|
874
|
+
body: '@demo/wallet for internal'
|
|
875
|
+
}
|
|
876
|
+
const expected = '<p><span> <a class=\"markdown-profile-link\" href=\"/@demo/wallet\">@demo/wallet</a> for internal</span></p>'
|
|
877
|
+
|
|
878
|
+
expect(markdown2Html(input, false)).toBe(expected)
|
|
879
|
+
})
|
|
868
880
|
})
|
|
869
881
|
|
|
870
882
|
describe("Rumble support", () => {
|
|
@@ -34,8 +34,13 @@ export function linkify(content: string, forApp: boolean, webp: boolean): string
|
|
|
34
34
|
/((^|\s)(\/|)@[\w.\d-]+)\/(\S+)/gi, (match, u, p1, p2, p3) => {
|
|
35
35
|
const uu = u.trim().toLowerCase().replace('/@','').replace('@','');
|
|
36
36
|
const perm = p3;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
if (['wallet', 'feed', 'followers', 'following', 'points', 'communities', 'posts', 'blog', 'comments', 'replies', 'settings', 'engine'].includes(p3)) {
|
|
38
|
+
const attrs = forApp ? `https://ecency.com/@${uu}/${perm}` : `href="/@${uu}/${perm}"`
|
|
39
|
+
return ` <a class="markdown-profile-link" ${attrs}>@${uu}/${perm}</a>`
|
|
40
|
+
} else {
|
|
41
|
+
const attrs = forApp ? `data-author="${uu}" data-tag="post" data-permlink="${perm}"` : `href="/post/@${uu}/${perm}"`
|
|
42
|
+
return ` <a class="markdown-post-link" ${attrs}>@${uu}/${perm}</a>`
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
)
|
|
41
46
|
|