@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.mjs
CHANGED
|
@@ -1069,9 +1069,9 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext, renderOptions) {
|
|
|
1069
1069
|
if (el.textContent === href) {
|
|
1070
1070
|
el.textContent = `@${author}/${section}`;
|
|
1071
1071
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
el.setAttribute("href",
|
|
1072
|
+
const external1 = renderOptions?.externalProfileBase;
|
|
1073
|
+
if (forApp || external1) {
|
|
1074
|
+
el.setAttribute("href", `${external1 ?? "https://ecency.com"}/@${author}/${section}`);
|
|
1075
1075
|
} else {
|
|
1076
1076
|
const h = `/@${author}/${section}`;
|
|
1077
1077
|
el.setAttribute("href", h);
|
|
@@ -1139,9 +1139,9 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext, renderOptions) {
|
|
|
1139
1139
|
if (el.textContent === href) {
|
|
1140
1140
|
el.textContent = `@${author}/${section}`;
|
|
1141
1141
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
el.setAttribute("href",
|
|
1142
|
+
const external2 = renderOptions?.externalProfileBase;
|
|
1143
|
+
if (forApp || external2) {
|
|
1144
|
+
el.setAttribute("href", `${external2 ?? "https://ecency.com"}/@${author}/${section}`);
|
|
1145
1145
|
} else {
|
|
1146
1146
|
const h = `/@${author}/${section}`;
|
|
1147
1147
|
el.setAttribute("href", h);
|
|
@@ -1799,7 +1799,8 @@ function linkify(content, forApp, renderOptions) {
|
|
|
1799
1799
|
const permlink = sanitizePermlink(p3);
|
|
1800
1800
|
if (!isValidPermlink(permlink)) return match;
|
|
1801
1801
|
if (SECTION_LIST.includes(permlink)) {
|
|
1802
|
-
const
|
|
1802
|
+
const external = renderOptions?.externalProfileBase;
|
|
1803
|
+
const attrs = forApp || external ? `href="${external ?? "https://ecency.com"}/@${authorLower}/${permlink}"` : `href="/@${authorLower}/${permlink}"`;
|
|
1803
1804
|
return `${preceding}<a class="markdown-profile-link" ${attrs}>@${authorLower}/${permlink}</a>`;
|
|
1804
1805
|
} else {
|
|
1805
1806
|
const attrs = forApp ? `data-author="${authorLower}" data-tag="${tag}" data-permlink="${permlink}"` : `href="/@${authorLower}/${permlink}"`;
|
|
@@ -1814,7 +1815,8 @@ function linkify(content, forApp, renderOptions) {
|
|
|
1814
1815
|
const permlink = sanitizePermlink(p3);
|
|
1815
1816
|
if (!isValidPermlink(permlink)) return match;
|
|
1816
1817
|
if (SECTION_LIST.includes(permlink)) {
|
|
1817
|
-
const
|
|
1818
|
+
const external = renderOptions?.externalProfileBase;
|
|
1819
|
+
const attrs = forApp || external ? `href="${external ?? "https://ecency.com"}/@${uu}/${permlink}"` : `href="/@${uu}/${permlink}"`;
|
|
1818
1820
|
return ` <a class="markdown-profile-link" ${attrs}>@${uu}/${permlink}</a>`;
|
|
1819
1821
|
} else {
|
|
1820
1822
|
const attrs = forApp ? `data-author="${uu}" data-tag="post" data-permlink="${permlink}"` : `href="/@${uu}/${permlink}"`;
|
|
@@ -2161,7 +2163,7 @@ function markdown2Html(obj, forApp = true, _webp = false, parentDomain = "ecency
|
|
|
2161
2163
|
logIfSlow(performance.now() - t02, `body_len=${obj.length}`);
|
|
2162
2164
|
return res2;
|
|
2163
2165
|
}
|
|
2164
|
-
const key = `${makeEntryCacheKey(obj)}-md-${forApp ? "app" : "site"}-${parentDomain}${seoContext ? `-seo${seoContext.authorReputation ?? ""}-${seoContext.postPayout ?? ""}` : ""}${renderOptions?.embedVideosDirectly ? "-embed" : ""}${renderOptions?.inertAuthorAndTagChips ? "-inert" : ""}`;
|
|
2166
|
+
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 : ""}`;
|
|
2165
2167
|
const item = cacheGet(key);
|
|
2166
2168
|
if (item) {
|
|
2167
2169
|
return item;
|