Wrap the markdown report in a dark-themed HTML page.
(self, result: PluginEvalResult)
| 164 | # ------------------------------------------------------------------ |
| 165 | |
| 166 | def to_html(self, result: PluginEvalResult) -> str: |
| 167 | """Wrap the markdown report in a dark-themed HTML page.""" |
| 168 | md_content = self.to_markdown(result) |
| 169 | # Escape for inclusion in a <pre> block isn't ideal; use a simple |
| 170 | # markdown-to-HTML approach with basic replacements. |
| 171 | escaped = md_content.replace("&", "&").replace("<", "<").replace(">", ">") |
| 172 | |
| 173 | return f"""<!DOCTYPE html> |
| 174 | <html lang="en"> |
| 175 | <head> |
| 176 | <meta charset="UTF-8" /> |
| 177 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 178 | <title>PluginEval Report</title> |
| 179 | <style> |
| 180 | :root {{ |
| 181 | --bg: #0d1117; |
| 182 | --surface: #161b22; |
| 183 | --border: #30363d; |
| 184 | --text: #c9d1d9; |
| 185 | --muted: #8b949e; |
| 186 | --accent: #58a6ff; |
| 187 | --green: #3fb950; |
| 188 | --red: #f85149; |
| 189 | }} |
| 190 | * {{ box-sizing: border-box; margin: 0; padding: 0; }} |
| 191 | body {{ |
| 192 | background: var(--bg); |
| 193 | color: var(--text); |
| 194 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace; |
| 195 | padding: 2rem; |
| 196 | line-height: 1.6; |
| 197 | }} |
| 198 | pre {{ |
| 199 | background: var(--surface); |
| 200 | border: 1px solid var(--border); |
| 201 | border-radius: 6px; |
| 202 | padding: 1.5rem; |
| 203 | overflow-x: auto; |
| 204 | white-space: pre-wrap; |
| 205 | font-size: 0.875rem; |
| 206 | font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; |
| 207 | }} |
| 208 | h1 {{ color: var(--accent); margin-bottom: 1rem; font-size: 1.5rem; }} |
| 209 | </style> |
| 210 | </head> |
| 211 | <body> |
| 212 | <pre>{escaped}</pre> |
| 213 | </body> |
| 214 | </html> |
| 215 | """ |
no test coverage detected