MCPcopy
hub / github.com/chinesehuazhou/python-weekly / content_to_string

Function content_to_string

resources/weekly_workflow.py:237–250  ·  view source on GitHub ↗

将解析后的markdown内容转换为格式化的字符串 :param contents: 包含标题和子标题的字典 :return: 格式化后的字符串,每个标题下的列表项使用圆圈数字标记

(contents)

Source from the content-addressed store, hash-verified

235 return parsed_content
236
237def 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
252def get_front_matter(file_path):
253 """

Callers 3

write_to_md_file_enFunction · 0.70
set_content_bodyFunction · 0.70
process_weeklyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected