Skip to content

Commit

Permalink
Updated styling on html
Browse files Browse the repository at this point in the history
  • Loading branch information
Gchism94 committed Mar 1, 2024
1 parent 45e8f76 commit c9cf9e3
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion jupyterquest/autograder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import glob
import markdown
from markdown.extensions.tables import TableExtension
from .repo_structure_check import check_directory_structure
from .code_quality_check import assess_code_quality
from .code_style_check import check_code_style
Expand All @@ -21,6 +22,50 @@ def save_html_report(html_content, file_path):
with open(file_path, 'w', encoding='utf-8') as f:
f.write(html_content)

def generate_html_with_css(markdown_content):
"""Generates HTML content with CSS styling from Markdown content."""
css_styles = """
<style>
body {
font-family: Segoe UI, sans-serif;
line-height: 1.6;
margin: 20px;
}
h1, h2, h3 {
color: #333;
}
table {
width: 100%;
border-collapse: collapse;
}
table, th, td {
border: 1px solid #dddddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
pre {
background-color: #f4f4f4;
border: 1px solid #ddd;
padding: 10px;
overflow: auto;
}
.critical {
color: red;
}
</style>
"""

# Convert Markdown to HTML
html_content = markdown.markdown(markdown_content, extensions=[TableExtension()])

# Combine CSS and HTML content
styled_html = css_styles + html_content

return styled_html

def main():
repo_path = os.getenv('GITHUB_WORKSPACE', '.')

Expand Down Expand Up @@ -76,7 +121,8 @@ def main():
)

# Convert Markdown report to HTML
final_report_html = markdown.markdown(final_report)
final_report_html = generate_html_with_css(final_report)


# Save the report as an .html file in the reports directory
report_file_path = os.path.join(repo_path, "reports", "autograder_report.html")
Expand Down

0 comments on commit c9cf9e3

Please sign in to comment.