Small fixes / cleaner code

This commit is contained in:
Simon Cambier
2022-04-28 22:57:29 +02:00
parent b64a7bf65a
commit d4ef232d8e
2 changed files with 14 additions and 9 deletions

View File

@@ -89,7 +89,7 @@ export function makeExcerpt(content: string, offset: number): string {
const pos = offset ?? -1
if (pos > -1) {
const from = Math.max(0, pos - excerptBefore)
const to = Math.min(content.length - 1, pos + excerptAfter)
const to = Math.min(content.length, pos + excerptAfter)
content =
(from > 0 ? '…' : '') +
content.slice(from, to).trim() +