🐛 Fixed iframe's appearing weirdly in excerpts

- A few users had noticed they get weird content in their excerpts when using e.g. an html block with an iframe
- This use case is common for people embedding podcasts at the top of their posts
This commit is contained in:
Hannah Wolfe 2022-08-10 17:36:58 +01:00
parent 9401d835ce
commit 27d1457a5b
No known key found for this signature in database
GPG Key ID: AB586C3B5AE5C037
2 changed files with 9 additions and 0 deletions

View File

@ -17,6 +17,8 @@ const baseSettings = {
selectors: [
// Ignore images, equiv ignoreImage: true
{selector: 'img', format: 'skip'},
// Ignore iframes
{selector: 'iframe', format: 'skip'},
// disable uppercase headings, equiv uppercaseHeadings: false
{selector: 'h1', options: {uppercase: false}},

View File

@ -86,5 +86,12 @@ describe('Html to Plaintext', function () {
const {excerpt} = getEmailandExcert(html);
assert.equal(excerpt, expected);
});
it('iframes', function () {
const html = '<!--kg-card-begin: html--><iframe frameborder="0" height="200" scrolling="no" src="https://playlist.megaphone.fm?e=1234567" width="100%"></iframe><!--kg-card-end: html--><p>Hello world.</p>';
const expected = 'Hello world.';
const {excerpt} = getEmailandExcert(html);
assert.equal(excerpt, expected);
});
});
});