Remove extra script tag from embedded gists to prevent them from mixing up (#14674)

This commit is contained in:
VISHAL DEEPAK 2021-11-30 02:18:20 +05:30 committed by GitHub
parent c3b2883aa3
commit def5de6d28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,11 +30,13 @@ function getGistTags(nodes) {
function loadEmbeddedGists(postscribe, gistTags) {
for (const gistTag of gistTags) {
postscribe(gistTag, gistTag.firstElementChild.outerHTML, {
const gistWrapper = gistTag.firstElementChild;
postscribe(gistTag, gistWrapper.outerHTML, {
beforeWrite(text) {
return gistTag.childElementCount > 3 ? '' : text;
},
});
gistWrapper.remove();
}
}