nast-util-to-html
Advanced tools
Comparing version 0.2.3 to 0.2.4
import Nast from 'notajs-types/nast'; | ||
/** !!! This should be replaced with more efficient implementation. */ | ||
declare function renderBookmark(node: Nast.WebBookmark): string; | ||
export default renderBookmark; | ||
//# sourceMappingURL=bookmark.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const render_utils_1 = require("../render-utils"); | ||
/** !!! This should be replaced with more efficient implementation. */ | ||
function renderBookmark(node) { | ||
let title = node.title ? node.title : ''; | ||
let link = node.link; | ||
let titleHTML = node.title ? `<h5>${node.title}</h5>` : ''; | ||
let descHTML = node.description ? `<p>${node.description}</p>` : ''; | ||
let linkHTML = `<p>${node.link}</p>`; | ||
let content = `\ | ||
<div style="display: flex;"> | ||
<div style="display: flex; text-align: left; overflow: hidden; border: 1px solid rgba(55, 53, 47, 0.16); border-radius: 0.7rem; position: relative; flex-grow: 1; color: rgb(55, 53, 47);"> | ||
<div style="min-height: 1rem; overflow: hidden; text-align: left; width: 100%;"> | ||
<a href="${link}" target="_blank" rel="noopener noreferrer" style="display: block; color: inherit; text-decoration: none;"> | ||
<div style="cursor: pointer; user-select: none; transition: background 120ms ease-in 0s; width: 100%; display: block; padding: 16px;"> | ||
<div style="font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">${title}</div> | ||
<div style="font-size: 12px; display: flex; overflow: hidden; padding-top: 3px;"> | ||
<div style="font-size: 12px; min-width: 0px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">${link}</div> | ||
</div> | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
</div>`; | ||
<a href="${node.link}"> | ||
${titleHTML} | ||
${descHTML} | ||
${linkHTML} | ||
</a>`; | ||
return render_utils_1.renderBlock(node, content); | ||
@@ -24,0 +15,0 @@ } |
{ | ||
"name": "nast-util-to-html", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Transform NAST to HTML.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index", |
@@ -5,24 +5,15 @@ import Nast from 'notajs-types/nast' | ||
/** !!! This should be replaced with more efficient implementation. */ | ||
function renderBookmark( | ||
node: Nast.WebBookmark | ||
): string { | ||
let title = node.title ? node.title : '' | ||
let link = node.link | ||
let titleHTML = node.title ? `<h5>${node.title}</h5>` : '' | ||
let descHTML = node.description ? `<p>${node.description}</p>` : '' | ||
let linkHTML = `<p>${node.link}</p>` | ||
let content = `\ | ||
<div style="display: flex;"> | ||
<div style="display: flex; text-align: left; overflow: hidden; border: 1px solid rgba(55, 53, 47, 0.16); border-radius: 0.7rem; position: relative; flex-grow: 1; color: rgb(55, 53, 47);"> | ||
<div style="min-height: 1rem; overflow: hidden; text-align: left; width: 100%;"> | ||
<a href="${link}" target="_blank" rel="noopener noreferrer" style="display: block; color: inherit; text-decoration: none;"> | ||
<div style="cursor: pointer; user-select: none; transition: background 120ms ease-in 0s; width: 100%; display: block; padding: 16px;"> | ||
<div style="font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">${title}</div> | ||
<div style="font-size: 12px; display: flex; overflow: hidden; padding-top: 3px;"> | ||
<div style="font-size: 12px; min-width: 0px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">${link}</div> | ||
</div> | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
</div>` | ||
<a href="${node.link}"> | ||
${titleHTML} | ||
${descHTML} | ||
${linkHTML} | ||
</a>` | ||
return renderBlock(node, content) | ||
@@ -29,0 +20,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
hast-util-to-html |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3494
293202
1