Merge pull request #4635 from tomholford/fix/notebook-index-image-preview

landscape: NotebookPreview can render image posts
This commit is contained in:
matildepark 2021-03-22 13:07:55 -04:00 committed by GitHub
commit cb0973867f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,7 +107,9 @@ export function getComments(node: GraphNode): GraphNode {
}
export function getSnippet(body: string) {
const start = body.slice(0, body.indexOf('\n', 2));
const newlineIdx = body.indexOf('\n', 2);
const end = newlineIdx > -1 ? newlineIdx : body.length;
const start = body.substr(0, end);
return (start === body || start.startsWith('![')) ? start : `${start}...`;
}