Open jacargentina opened 4 years ago
I need to maintain the YouTube embeds on my HTML when converting to MD.
const TurndownService = require('turndown'); var turndownService = new TurndownService(); turndownService.keep(['iframe']); const html = ` <p>My video</p> <div class="video-container"> <iframe src="https://www.youtube.com/embed/...." width="640" height="360" frameborder="0" allowfullscreen=""></iframe> </div>`; console.log(turndownService.turndown(html));
My video
But if I rework the HTML to a self-closing then it works!
const TurndownService = require('turndown'); var turndownService = new TurndownService(); turndownService.keep(['iframe']); const html = ` <p>My video</p> <div class="video-container"> <iframe src="https://www.youtube.com/embed/...." width="640" height="360" frameborder="0" allowfullscreen="" /> </div>`; console.log(turndownService.turndown(html));
I am also seeing this issue with ins tags created with Google AdSense. Might it be an issue with any empty tag?
ins
I need to maintain the YouTube embeds on my HTML when converting to MD.
Output
My video
BUT
But if I rework the HTML to a self-closing then it works!
OUTPUT
My video