Skip to content

Commit

Permalink
fix bug on linkTool parser
Browse files Browse the repository at this point in the history
  • Loading branch information
rizki4106 committed Sep 21, 2022
1 parent 9b10015 commit bd4708d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const renderHTML = (val) => {
case "paragraph":
value += paragraph(items.data.text)
break;
case "link":
value += link(items.data.link)
case "linkTool":
value += link(items.data)
break;
case "Header":
value += head(items.data.text, items.data.level)
Expand Down
10 changes: 9 additions & 1 deletion link/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
const link = (param) => {
return `<a href='${param}' target='_blank'>${param}</a>`
const domain = param.link.split('/')
const selected_domain = domain[2]

return `
<a href='${param.link}' class='linkTool'>
<h4>${param.meta.title}</h4>
<p>${param.meta.description}</p>
<small>${selected_domain}</small>
</a>`
}
module.exports = link
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "editorjs-viewer",
"version": "1.0.3",
"version": "1.1.3",
"description": "easy change json data to html from editorjs",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit bd4708d

Please sign in to comment.