]> Untitled Git - lemmy.git/blobdiff - ui/src/utils.ts
Updating code url references to https://github.com/LemmyNet/lemmy
[lemmy.git] / ui / src / utils.ts
index 8ecef19b68aa0d976566a8fc4e9177cc2953f53b..ceb05764d27e389f3047a34f62987f21cdef11f6 100644 (file)
@@ -44,7 +44,7 @@ import emojiShortName from 'emoji-short-name';
 import Toastify from 'toastify-js';
 import tippy from 'tippy.js';
 
-export const repoUrl = 'https://github.com/dessalines/lemmy';
+export const repoUrl = 'https://github.com/LemmyNet/lemmy';
 export const helpGuideUrl = '/docs/about_guide.html';
 export const markdownHelpUrl = `${helpGuideUrl}#markdown-guide`;
 export const sortingHelpUrl = `${helpGuideUrl}#sorting`;
@@ -823,3 +823,11 @@ function hsl(num: number) {
 function randomHsl() {
   return `hsla(${Math.random() * 360}, 100%, 50%, 1)`;
 }
+
+export function previewLines(text: string, lines: number = 3): string {
+  // Use lines * 2 because markdown requires 2 lines
+  return text
+    .split('\n')
+    .slice(0, lines * 2)
+    .join('\n');
+}