UI: Use a tab length of 2 for lists (rather than 4)

This commit is contained in:
oobabooga 2025-01-01 13:53:50 -08:00
parent 7b88724711
commit 725639118a

View File

@ -195,7 +195,7 @@ def convert_to_markdown(string):
result = re.sub(list_item_pattern, r'\g<1> ' + delete_str, result) result = re.sub(list_item_pattern, r'\g<1> ' + delete_str, result)
# Convert to HTML using markdown # Convert to HTML using markdown
html_output = markdown.markdown(result, extensions=['fenced_code', 'tables']) html_output = markdown.markdown(result, extensions=['fenced_code', 'tables'], tab_length=2)
# Remove the delete string from the HTML output # Remove the delete string from the HTML output
pos = html_output.rfind(delete_str) pos = html_output.rfind(delete_str)
@ -203,7 +203,7 @@ def convert_to_markdown(string):
html_output = html_output[:pos] + html_output[pos + len(delete_str):] html_output = html_output[:pos] + html_output[pos + len(delete_str):]
else: else:
# Convert to HTML using markdown # Convert to HTML using markdown
html_output = markdown.markdown(result, extensions=['fenced_code', 'tables']) html_output = markdown.markdown(result, extensions=['fenced_code', 'tables'], tab_length=2)
# Unescape code blocks # Unescape code blocks
pattern = re.compile(r'<code[^>]*>(.*?)</code>', re.DOTALL) pattern = re.compile(r'<code[^>]*>(.*?)</code>', re.DOTALL)