gfm_supported

This commit is contained in:
mrT23
2023-10-05 18:08:02 +03:00
parent 72eecbbf61
commit 1bab26f1c5

View File

@ -62,7 +62,7 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool=True) -> str:
markdown_text += f"- {emoji} **{key}:**\n\n"
for item in value:
if isinstance(item, dict) and key.lower() == 'code feedback':
markdown_text += parse_code_suggestion(item)
markdown_text += parse_code_suggestion(item, gfm_supported)
elif item:
markdown_text += f" - {item}\n"
if key.lower() == 'code feedback':
@ -76,7 +76,7 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool=True) -> str:
return markdown_text
def parse_code_suggestion(code_suggestions: dict) -> str:
def parse_code_suggestion(code_suggestions: dict, gfm_supported: bool=True) -> str:
"""
Convert a dictionary of data into markdown format.
@ -99,8 +99,9 @@ def parse_code_suggestion(code_suggestions: dict) -> str:
markdown_text += f"\n - **{sub_key}:** {sub_value}\n"
else:
markdown_text += f" **{sub_key}:** {sub_value}\n"
if "relevant line" not in sub_key.lower(): # nicer presentation
markdown_text = markdown_text.rstrip('\n') + "\\\n"
if not gfm_supported:
if "relevant line" not in sub_key.lower(): # nicer presentation
markdown_text = markdown_text.rstrip('\n') + "\\\n"
markdown_text += "\n"
return markdown_text