将解析后的markdown内容转换为格式化的字符串 :param contents: 包含标题和子标题的字典 :return: 格式化后的字符串,每个标题下的列表项使用圆圈数字标记
(contents)
| 235 | return parsed_content |
| 236 | |
| 237 | def content_to_string(contents): |
| 238 | """ |
| 239 | 将解析后的markdown内容转换为格式化的字符串 |
| 240 | :param contents: 包含标题和子标题的字典 |
| 241 | :return: 格式化后的字符串,每个标题下的列表项使用圆圈数字标记 |
| 242 | """ |
| 243 | message = "" |
| 244 | for section, sub_sections in contents.items(): |
| 245 | if sub_sections: # 只处理有子标题的部分 |
| 246 | message += f"**{section}**\n\n" |
| 247 | for i, sub_section in enumerate(sub_sections, 1): |
| 248 | message += f"{chr(9311 + i)} {sub_section}\n" |
| 249 | message += "\n" |
| 250 | return message |
| 251 | |
| 252 | def get_front_matter(file_path): |
| 253 | """ |
no outgoing calls
no test coverage detected