markdown: Remove paragraphs that only contain a tweet link.

This is similar to our behavior with image previews, and helps
reduce clutter in the final rendered html.

We add the string 'Tweet: ' to our existing tests so those tests
remain the same.
This commit is contained in:
Rohitt Vashishtha
2020-07-13 22:14:35 +05:30
committed by Tim Abbott
parent 87e01cd1fa
commit d3770153a6
2 changed files with 17 additions and 16 deletions

View File

@@ -1070,6 +1070,8 @@ class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):
div.set("class", "inline-preview-twitter")
div.insert(0, twitter_data)
if info['remove'] is not None:
info['parent'].remove(info['remove'])
def find_proper_insertion_index(self, grandparent: Element, parent: Element,
parent_index_in_grandparent: int) -> int: