@ecency/render-helper 2.2.33 → 2.2.35

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecency/render-helper",
3
- "version": "2.2.33",
3
+ "version": "2.2.35",
4
4
  "description": "Markdown+Html Render helper",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -11,7 +11,7 @@ export const INTERNAL_TOPIC_REGEX = /^\/(trending|hot|created|promoted|muted|pay
11
11
  export const INTERNAL_POST_TAG_REGEX = /(.*)\/(@[\w.\d-]+)\/(.*)/i
12
12
  export const INTERNAL_POST_REGEX = /^\/(@[\w.\d-]+)\/(.*)$/i
13
13
  export const CUSTOM_COMMUNITY_REGEX = /^https?:\/\/(.*)\/c\/(hive-\d+)(.*)/i
14
- export const YOUTUBE_REGEX = /(?:youtube.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu.be\/)([^"&?\/\s]{11})/g
14
+ export const YOUTUBE_REGEX = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|shorts\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/g
15
15
  export const YOUTUBE_EMBED_REGEX = /^(https?:)?\/\/www.youtube.com\/(embed|shorts)\/.*/i
16
16
  export const VIMEO_REGEX = /(https?:\/\/)?(www\.)?(?:vimeo)\.com.*(?:videos|video|channels|)\/([\d]+)/i
17
17
  export const VIMEO_EMBED_REGEX = /https:\/\/player\.vimeo\.com\/video\/([0-9]+)/
@@ -950,6 +950,18 @@ describe('Markdown2Html', () => {
950
950
 
951
951
  expect(markdown2Html(input, false)).toBe(expected)
952
952
  })
953
+
954
+ it('70- Should handle youtube shorts/videos', () => {
955
+ const input = {
956
+ author: 'foo370',
957
+ permlink: 'bar370',
958
+ last_update: '2019-05-10T09:15:21',
959
+ body: 'https://www.youtube.com/shorts/IaehbZnsi4w'
960
+ }
961
+ const expected = '<p dir=\"auto\"><a class="markdown-video-link markdown-video-link-youtube" data-embed-src="https://www.youtube.com/embed/IaehbZnsi4w?autoplay=1" data-youtube="IaehbZnsi4w"><img class="no-replace video-thumbnail" src="https://images.ecency.com/p/S5Eokt4BcQdk7EHeT1aYjzebg2hC7hkthT45e5VviwaTq13pYBZesC7Hh3idYK26Q1RMUHU.png?format=match&amp;mode=fit" /><span class="markdown-video-play"></span></a></p>'
962
+
963
+ expect(markdown2Html(input)).toBe(expected)
964
+ })
953
965
  })
954
966
 
955
967
  describe("Rumble support", () => {
@@ -23,6 +23,7 @@ export function cleanReply(s: string): string {
23
23
  .filter(item => item.toLowerCase().includes('▶️ [watch on 3speak](https://3speak') === false)
24
24
  .filter(item => item.toLowerCase().includes('<sup><sub>posted via [inji.com]') === false)
25
25
  .filter(item => item.toLowerCase().includes('view this post on [liketu]') === false)
26
+ .filter(item => item.toLowerCase().includes('[via Inbox]') === false)
26
27
  .join('\n') : '')
27
28
  .replace('Posted via <a href="https://d.buzz" data-link="promote-link">D.Buzz</a>', '')
28
29
  .replace('<div class="pull-right"><a href="/@hive.engage">![](https://i.imgur.com/XsrNmcl.png)</a></div>', '')