fix: ignore code block lines when create excerpt (#5495)

This commit is contained in:
Alexey Pyltsyn 2021-09-22 11:15:46 +03:00 committed by GitHub
parent ebf81b6ef6
commit 578470a24c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -129,6 +129,19 @@ describe('createExcerpt', () => {
`),
).toEqual('Markdown title');
});
test('should create excerpt for content with various code blocks', () => {
expect(
createExcerpt(dedent`
\`\`\`jsx
import React from 'react';
import Layout from '@theme/Layout';
\`\`\`
Lorem \`ipsum\` dolor sit amet, consectetur \`adipiscing elit\`.
`),
).toEqual('Lorem ipsum dolor sit amet, consectetur adipiscing elit.');
});
});
describe('parseMarkdownContentTitle', () => {