@@ -75,9 +75,9 @@ def convert_to_markdown(output_data: dict, gfm_supported: bool=True) -> str:
75
75
if gfm_supported :
76
76
markdown_text += f"\n \n "
77
77
markdown_text += f"<details><summary> <strong>Code feedback:</strong></summary>\n \n "
78
+ markdown_text += "<hr>"
78
79
else :
79
80
markdown_text += f"\n \n ** Code feedback:**\n \n "
80
- markdown_text += "<hr>"
81
81
for i , value in enumerate (output_data ['code_feedback' ]):
82
82
if value is None or value == '' or value == {} or value == []:
83
83
continue
@@ -131,6 +131,10 @@ def parse_code_suggestion(code_suggestion: dict, i: int = 0, gfm_supported: bool
131
131
markdown_text += "<hr>"
132
132
else :
133
133
for sub_key , sub_value in code_suggestion .items ():
134
+ if isinstance (sub_key , str ):
135
+ sub_key = sub_key .rstrip ()
136
+ if isinstance (sub_value ,str ):
137
+ sub_value = sub_value .rstrip ()
134
138
if isinstance (sub_value , dict ): # "code example"
135
139
markdown_text += f" - **{ sub_key } :**\n "
136
140
for code_key , code_value in sub_value .items (): # 'before' and 'after' code
@@ -142,10 +146,9 @@ def parse_code_suggestion(code_suggestion: dict, i: int = 0, gfm_supported: bool
142
146
markdown_text += f"\n - **{ sub_key } :** { sub_value } \n "
143
147
else :
144
148
markdown_text += f" **{ sub_key } :** { sub_value } \n "
145
- if not gfm_supported :
146
- if "relevant_line" not in sub_key .lower (): # nicer presentation
147
- # markdown_text = markdown_text.rstrip('\n') + "\\\n" # works for gitlab
148
- markdown_text = markdown_text .rstrip ('\n ' ) + " \n " # works for gitlab and bitbucker
149
+ if "relevant_line" not in sub_key .lower (): # nicer presentation
150
+ # markdown_text = markdown_text.rstrip('\n') + "\\\n" # works for gitlab
151
+ markdown_text = markdown_text .rstrip ('\n ' ) + " \n " # works for gitlab and bitbucker
149
152
150
153
markdown_text += "\n "
151
154
return markdown_text
0 commit comments