@ecency/render-helper 2.4.27 → 2.4.28

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.
@@ -61,4 +61,14 @@ declare const SECTION_LIST: string[];
61
61
 
62
62
  declare function isValidPermlink(permlink: string): boolean;
63
63
 
64
- export { type Entry, type RenderOptions, SECTION_LIST, type SeoContext, catchPostImage, isValidPermlink, getPostBodySummary as postBodySummary, proxifyImageSrc, markdown2Html as renderPostBody, setCacheSize, setProxyBase };
64
+ /**
65
+ * Lightweight markdown-to-HTML conversion with sanitization.
66
+ * Unlike the full `markdownToHTML`, this skips Hive-specific transforms
67
+ * (image proxying, link internalizing, DOM traversal, etc.).
68
+ *
69
+ * Intended for editor input (TipTap), chat messages, and other contexts
70
+ * where simple markdown rendering is sufficient.
71
+ */
72
+ declare function simpleMarkdownToHTML(input: string): string;
73
+
74
+ export { type Entry, type RenderOptions, SECTION_LIST, type SeoContext, catchPostImage, isValidPermlink, getPostBodySummary as postBodySummary, proxifyImageSrc, markdown2Html as renderPostBody, setCacheSize, setProxyBase, simpleMarkdownToHTML };
@@ -1551,6 +1551,22 @@ function markdownToHTML(input, forApp, parentDomain = "ecency.com", seoContext,
1551
1551
  output = output.replace(/ xmlns="http:\/\/www.w3.org\/1999\/xhtml"/g, "").replace('<body id="root">', "").replace("</body>", "").trim();
1552
1552
  return sanitizeHtml(output);
1553
1553
  }
1554
+ var mdInstance = null;
1555
+ function getMd() {
1556
+ if (!mdInstance) {
1557
+ mdInstance = new Remarkable({
1558
+ html: true,
1559
+ breaks: true,
1560
+ typographer: false
1561
+ }).use(linkify$1);
1562
+ }
1563
+ return mdInstance;
1564
+ }
1565
+ function simpleMarkdownToHTML(input) {
1566
+ if (!input) return "";
1567
+ const html = getMd().render(input);
1568
+ return sanitizeHtml(html);
1569
+ }
1554
1570
  var cache = new LRUCache({ max: 60 });
1555
1571
  function setCacheSize(size) {
1556
1572
  cache = new LRUCache({ max: size });
@@ -1758,6 +1774,6 @@ function getPostBodySummary(obj, length, platform) {
1758
1774
  return res;
1759
1775
  }
1760
1776
 
1761
- export { SECTION_LIST, catchPostImage, isValidPermlink, getPostBodySummary as postBodySummary, proxifyImageSrc, markdown2Html as renderPostBody, setCacheSize, setProxyBase };
1777
+ export { SECTION_LIST, catchPostImage, isValidPermlink, getPostBodySummary as postBodySummary, proxifyImageSrc, markdown2Html as renderPostBody, setCacheSize, setProxyBase, simpleMarkdownToHTML };
1762
1778
  //# sourceMappingURL=index.js.map
1763
1779
  //# sourceMappingURL=index.js.map