@@ -0,0 +1,1535 @@
+%22%22%22%0ANew Tab Extension for Python-Markdown%0A=====================================%0AModify the behavior of Links in Python-Markdown to open a in a new%0Awindow. This changes the HTML output to add target=%22_blank%22 to all%0Agenerated links.%0A%22%22%22%0A%0Aimport markdown%0Afrom markdown.inlinepatterns import %5C%0A    LinkPattern, ReferencePattern, AutolinkPattern, AutomailPattern, %5C%0A    LINK_RE, REFERENCE_RE, SHORT_REF_RE, AUTOLINK_RE, AUTOMAIL_RE%0A%0A%0Aclass NewTabMixin(object):%0A    def handleMatch(self, m):%0A        el = super(NewTabMixin, self).handleMatch(m)%0A        if el is not None:%0A            el.set('target', '_blank')%0A        return el%0A%0A%0Aclass NewTabLinkPattern(NewTabMixin, LinkPattern):%0A    pass%0A%0A%0Aclass NewTabReferencePattern(NewTabMixin, ReferencePattern):%0A    pass%0A%0A%0Aclass NewTabAutolinkPattern(NewTabMixin, AutolinkPattern):%0A    pass%0A%0A%0Aclass NewTabAutomailPattern(NewTabMixin, AutomailPattern):%0A    pass%0A%0A%0Aclass NewTabExtension(markdown.Extension):%0A    %22%22%22%0A    Modifies HTML output to open links in a new tab.%0A    %22%22%22%0A%0A    def extendMarkdown(self, md, md_globals):%0A        md.inlinePatterns%5B'link'%5D = NewTabLinkPattern(LINK_RE, md)%0A        md.inlinePatterns%5B'reference'%5D = NewTabReferencePattern(REFERENCE_RE, md)%0A        md.inlinePatterns%5B'short_reference'%5D = NewTabReferencePattern(SHORT_REF_RE, md)%0A        md.inlinePatterns%5B'autolink'%5D = NewTabAutolinkPattern(AUTOLINK_RE, md)%0A        md.inlinePatterns%5B'automail'%5D = NewTabAutomailPattern(AUTOMAIL_RE, md)%0A%0A%0Adef makeExtension(*args, **kwargs):%0A    return NewTabExtension(*args, **kwargs)%0A

Add new plugin