from anyqa.config import get_sources | |
def generate_source_table(): | |
# Define the headers for the table | |
headers = ["Type", "Name", "URL"] | |
# Create the Markdown string for the headers | |
header_str = " | ".join(headers) | |
# Create the Markdown string for the header separator | |
separator_str = " | ".join(["---"] * len(headers)) | |
# Initialize an empty list to hold the rows | |
rows = [] | |
# Add each row to the list | |
for source in get_sources(): | |
row = [ | |
source.get("domain", ""), | |
source.get("name", ""), | |
source.get("url", ""), | |
] | |
row_str = " | ".join(row) | |
rows.append(row_str) | |
# Combine all the parts into the final Markdown table | |
markdown_table = header_str + "\n" + separator_str + "\n" + "\n".join(rows) | |
return markdown_table | |