--- a/Allura/allura/lib/markdown_extensions.py
+++ b/Allura/allura/lib/markdown_extensions.py
@@ -33,6 +33,8 @@
def extendMarkdown(self, md, md_globals):
md.registerExtension(self)
+ # allow markdown within e.g. <div markdown>...</div> More info at: https://github.com/waylan/Python-Markdown/issues/52
+ md.preprocessors['html_block'].markdown_in_raw = True
md.preprocessors['fenced-code'] = FencedCodeProcessor()
md.preprocessors.add('plain_text_block', PlainTextPreprocessor(md), "_begin")
md.inlinePatterns['autolink_1'] = AutolinkPattern(r'(http(?:s?)://[a-zA-Z0-9./\-_0%?&=+#;~:]+)')
@@ -104,9 +106,18 @@
if shortlink:
href = shortlink.url
self.ext.forge_link_tree_processor.alinks.append(shortlink)
- elif self.ext._use_wiki and ':' not in link:
+ elif self.ext._use_wiki and is_link_with_brackets:
href = h.urlquote(link)
classes += ' notfound'
+ attach_link = link.split('/attachment/')
+ if len(attach_link) == 2 and self.ext._use_wiki:
+ shortlink = M.Shortlink.lookup(attach_link[0])
+ if shortlink:
+ attach_status = ' notfound'
+ for attach in shortlink.ref.artifact.attachments:
+ if attach.filename == attach_link[1]:
+ attach_status = ''
+ classes += attach_status
return href, classes