Skip to content

Commit

Permalink
fix few internal links
Browse files Browse the repository at this point in the history
  • Loading branch information
feruzm committed Feb 11, 2024
1 parent 9768dbf commit 616f9be
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ecency/render-helper",
"version": "2.2.29",
"version": "2.2.30",
"description": "Markdown+Html Render helper",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
14 changes: 13 additions & 1 deletion src/markdown-2-html.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ describe('Markdown2Html', () => {
author: 'foo358',
permlink: 'bar358',
last_update: '2021-08-18T09:15:49',
body: `<p><strong>It's a Secret, But is it good to have secrets?</strong><br>
body: `<p><strong>It's a Secret, But is it good to have secrets?</strong><br>
https://peakd.com/hive-123046/@ecotrain/ecotrain-question-of-the-week-season-5-1tie-up-post-it-s-a-secret-but-is-it-good-to-have-secrets </p> `
}
const expected = '<p><strong>It\'s a Secret, But is it good to have secrets?</strong><br /><a data-tag=\"hive-123046\" data-author=\"ecotrain\" data-permlink=\"ecotrain-question-of-the-week-season-5-1tie-up-post-it-s-a-secret-but-is-it-good-to-have-secrets\" class=\"markdown-post-link\">/@ecotrain/ecotrain-question-of-the-week-season-5-1tie-up-post-it-s-a-secret-but-is-it-good-to-have-secrets</a></p>'
Expand Down Expand Up @@ -938,6 +938,18 @@ describe('Markdown2Html', () => {

expect(markdown2Html(input, false)).toBe(expected)
})

it('69 - Should handle section links', () => {
const input = {
author: 'foo369',
permlink: 'bar369',
last_update: '2019-05-10T09:15:21',
body: 'this is link https://inleo.io/@godfish/close-range-reflections'
}
const expected = '<p>this is link <a href="/post/@godfish/close-range-reflections" class="markdown-post-link">@godfish/close-range-reflections</a></p>'

expect(markdown2Html(input, false)).toBe(expected)
})
})

describe("Rumble support", () => {
Expand Down
2 changes: 2 additions & 0 deletions src/methods/clean-reply.method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export function cleanReply(s: string): string {
.filter(item => item.toLowerCase().includes('posted with [stemgeeks') === false)
.filter(item => item.toLowerCase().includes('posted using [bilpcoin') === false)
.filter(item => item.toLowerCase().includes('posted using [inleo') === false)
.filter(item => item.toLowerCase().includes('posted using [sportstalksocial]') === false)
.filter(item => item.toLowerCase().includes('<center><sub>[posted using aeneas.blog') === false)
.filter(item => item.toLowerCase().includes('<center><sub>posted via [proofofbrain.io') === false)
.filter(item => item.toLowerCase().includes('<center>posted on [hypnochain') === false)
Expand All @@ -24,4 +25,5 @@ export function cleanReply(s: string): string {
.join('\n') : '')
.replace('Posted via <a href="https://d.buzz" data-link="promote-link">D.Buzz</a>', '')
.replace('<div class="pull-right"><a href="/@hive.engage">![](https://i.imgur.com/XsrNmcl.png)</a></div>', '')
.replace('<div><a href="https://engage.hivechain.app">![](https://i.imgur.com/XsrNmcl.png)</a></div>', '')
}
3 changes: 3 additions & 0 deletions src/methods/markdown-to-html.method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export function markdownToHTML(input: string, forApp: boolean, webp: boolean): s
input = input.replace(new RegExp("https://leofinance.io/threads/view/","g"), "/@");
input = input.replace(new RegExp("https://leofinance.io/posts/","g"), "/@");
input = input.replace(new RegExp("https://leofinance.io/threads/","g"), "/@");
input = input.replace(new RegExp("https://inleo.io/threads/view/","g"), "/@");
input = input.replace(new RegExp("https://inleo.io/posts/","g"), "/@");
input = input.replace(new RegExp("https://inleo.io/threads/","g"), "/@");


const md = new Remarkable({
Expand Down

0 comments on commit 616f9be

Please sign in to comment.