Buckets:
| """Render report/NVFP4_REPORT.md -> report/NVFP4_REPORT.pdf with figures embedded (weasyprint).""" | |
| import os, markdown | |
| from weasyprint import HTML, CSS | |
| md = open("report/NVFP4_REPORT.md").read() | |
| body = markdown.markdown(md, extensions=["tables", "fenced_code", "sane_lists"]) | |
| base = open("report/style.css").read() if os.path.exists("report/style.css") else "" | |
| extra = """ | |
| @page { size: A4; margin: 1.4cm; } | |
| body { font-family: -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif; font-size: 10.5px; color:#1a1a1a; line-height:1.45; } | |
| h1 { font-size: 20px; margin:0 0 4px; } | |
| h2 { font-size: 14px; border-bottom: 1.5px solid #ccc; padding-bottom: 2px; margin-top: 16px; } | |
| h3 { font-size: 12px; } | |
| img { max-width: 100%; height: auto; display: block; margin: 8px auto; } | |
| table { border-collapse: collapse; width: 100%; margin: 6px 0; } | |
| th, td { border: 1px solid #bbb; padding: 2px 6px; font-size: 9.5px; text-align: left; } | |
| th { background: #f0f0f0; } | |
| code { background: #f3f3f3; padding: 0 2px; font-size: 9.5px; } | |
| strong { color: #b00; } | |
| """ | |
| HTML(string=f"<html><head><meta charset='utf-8'></head><body>{body}</body></html>", | |
| base_url="report/").write_pdf("report/NVFP4_REPORT.pdf", stylesheets=[CSS(string=base + extra)]) | |
| print("wrote report/NVFP4_REPORT.pdf") | |
Xet Storage Details
- Size:
- 1.27 kB
- Xet hash:
- c25e8bdff47767e23a46f65238a8117a3c71dd8307ce3dbb38da31173dbc4551
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.