@ecency/render-helper 2.5.25 → 2.5.26
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/README.md +3 -3
- package/dist/browser/index.d.ts +16 -0
- package/dist/browser/index.js +11 -9
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +11 -9
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +11 -9
- package/dist/node/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/node/index.cjs
CHANGED
|
@@ -1097,9 +1097,9 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext, renderOptions) {
|
|
|
1097
1097
|
if (el.textContent === href) {
|
|
1098
1098
|
el.textContent = `@${author}/${section}`;
|
|
1099
1099
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
el.setAttribute("href",
|
|
1100
|
+
const external1 = renderOptions?.externalProfileBase;
|
|
1101
|
+
if (forApp || external1) {
|
|
1102
|
+
el.setAttribute("href", `${external1 ?? "https://ecency.com"}/@${author}/${section}`);
|
|
1103
1103
|
} else {
|
|
1104
1104
|
const h = `/@${author}/${section}`;
|
|
1105
1105
|
el.setAttribute("href", h);
|
|
@@ -1167,9 +1167,9 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext, renderOptions) {
|
|
|
1167
1167
|
if (el.textContent === href) {
|
|
1168
1168
|
el.textContent = `@${author}/${section}`;
|
|
1169
1169
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
el.setAttribute("href",
|
|
1170
|
+
const external2 = renderOptions?.externalProfileBase;
|
|
1171
|
+
if (forApp || external2) {
|
|
1172
|
+
el.setAttribute("href", `${external2 ?? "https://ecency.com"}/@${author}/${section}`);
|
|
1173
1173
|
} else {
|
|
1174
1174
|
const h = `/@${author}/${section}`;
|
|
1175
1175
|
el.setAttribute("href", h);
|
|
@@ -1827,7 +1827,8 @@ function linkify(content, forApp, renderOptions) {
|
|
|
1827
1827
|
const permlink = sanitizePermlink(p3);
|
|
1828
1828
|
if (!isValidPermlink(permlink)) return match;
|
|
1829
1829
|
if (SECTION_LIST.includes(permlink)) {
|
|
1830
|
-
const
|
|
1830
|
+
const external = renderOptions?.externalProfileBase;
|
|
1831
|
+
const attrs = forApp || external ? `href="${external ?? "https://ecency.com"}/@${authorLower}/${permlink}"` : `href="/@${authorLower}/${permlink}"`;
|
|
1831
1832
|
return `${preceding}<a class="markdown-profile-link" ${attrs}>@${authorLower}/${permlink}</a>`;
|
|
1832
1833
|
} else {
|
|
1833
1834
|
const attrs = forApp ? `data-author="${authorLower}" data-tag="${tag}" data-permlink="${permlink}"` : `href="/@${authorLower}/${permlink}"`;
|
|
@@ -1842,7 +1843,8 @@ function linkify(content, forApp, renderOptions) {
|
|
|
1842
1843
|
const permlink = sanitizePermlink(p3);
|
|
1843
1844
|
if (!isValidPermlink(permlink)) return match;
|
|
1844
1845
|
if (SECTION_LIST.includes(permlink)) {
|
|
1845
|
-
const
|
|
1846
|
+
const external = renderOptions?.externalProfileBase;
|
|
1847
|
+
const attrs = forApp || external ? `href="${external ?? "https://ecency.com"}/@${uu}/${permlink}"` : `href="/@${uu}/${permlink}"`;
|
|
1846
1848
|
return ` <a class="markdown-profile-link" ${attrs}>@${uu}/${permlink}</a>`;
|
|
1847
1849
|
} else {
|
|
1848
1850
|
const attrs = forApp ? `data-author="${uu}" data-tag="post" data-permlink="${permlink}"` : `href="/@${uu}/${permlink}"`;
|
|
@@ -2189,7 +2191,7 @@ function markdown2Html(obj, forApp = true, _webp = false, parentDomain = "ecency
|
|
|
2189
2191
|
logIfSlow(performance.now() - t02, `body_len=${obj.length}`);
|
|
2190
2192
|
return res2;
|
|
2191
2193
|
}
|
|
2192
|
-
const key = `${makeEntryCacheKey(obj)}-md-${forApp ? "app" : "site"}-${parentDomain}${seoContext ? `-seo${seoContext.authorReputation ?? ""}-${seoContext.postPayout ?? ""}` : ""}${renderOptions?.embedVideosDirectly ? "-embed" : ""}${renderOptions?.inertAuthorAndTagChips ? "-inert" : ""}`;
|
|
2194
|
+
const key = `${makeEntryCacheKey(obj)}-md-${forApp ? "app" : "site"}-${parentDomain}${seoContext ? `-seo${seoContext.authorReputation ?? ""}-${seoContext.postPayout ?? ""}` : ""}${renderOptions?.embedVideosDirectly ? "-embed" : ""}${renderOptions?.inertAuthorAndTagChips ? "-inert" : ""}${renderOptions?.externalProfileBase ? "-ext" + renderOptions.externalProfileBase : ""}`;
|
|
2193
2195
|
const item = cacheGet(key);
|
|
2194
2196
|
if (item) {
|
|
2195
2197
|
return item;
|