diff --git a/pluginHolder/views.py b/pluginHolder/views.py index 6ddc3de97..8860e43f2 100644 --- a/pluginHolder/views.py +++ b/pluginHolder/views.py @@ -959,21 +959,41 @@ def plugin_help(request, plugin_name): else: # Convert markdown to HTML (basic conversion) import re - # Basic markdown to HTML conversion + # Convert linked images first (badges): [![alt](img_url)](link_url) + help_content = re.sub( + r'\[!\[([^\]]*)\]\(([^\)]+)\)\]\(([^\)]+)\)', + r'\1', + help_content + ) + # Convert regular images: ![alt](img_url) + help_content = re.sub( + r'!\[([^\]]*)\]\(([^\)]+)\)', + r'\1', + help_content + ) + # Convert regular links: [text](url) + help_content = re.sub( + r'\[([^\]]+)\]\(([^\)]+)\)', + r'\1', + help_content + ) + # Convert headings help_content = re.sub(r'^### (.*?)$', r'

\1

', help_content, flags=re.MULTILINE) help_content = re.sub(r'^## (.*?)$', r'

\1

', help_content, flags=re.MULTILINE) help_content = re.sub(r'^# (.*?)$', r'

\1

', help_content, flags=re.MULTILINE) + # Convert formatting help_content = re.sub(r'\*\*(.*?)\*\*', r'\1', help_content) help_content = re.sub(r'\*(.*?)\*', r'\1', help_content) help_content = re.sub(r'`([^`]+)`', r'\1', help_content) + # Convert lists help_content = re.sub(r'^\- (.*?)$', r'
  • \1
  • ', help_content, flags=re.MULTILINE) help_content = re.sub(r'^(\d+)\. (.*?)$', r'
  • \2
  • ', help_content, flags=re.MULTILINE) - # Wrap paragraphs + # Wrap paragraphs (but preserve HTML tags and images) lines = help_content.split('\n') processed_lines = [] for line in lines: line = line.strip() - if line and not line.startswith('<'): + if line and not line.startswith('<') and not line.startswith('http') and not '{line}

    ') elif line: processed_lines.append(line)