From 45265a4e8c67f046892dc7d1ed87df4bb35e3e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Sat, 22 Nov 2025 13:34:29 +0000 Subject: [PATCH] Improve colophon rendering --- build_colophon.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/build_colophon.py b/build_colophon.py index df76e31..f7d474e 100755 --- a/build_colophon.py +++ b/build_colophon.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 import json -import re from datetime import datetime import html from pathlib import Path @@ -14,11 +13,22 @@ def format_commit_message(message): - """Format commit message with line breaks and linkified URLs.""" + """Render commit message as HTML with Markdown support.""" + escaped = html.escape(message) - url_pattern = r"(https?://[^\s]+)" - linkified = re.sub(url_pattern, r'\1', escaped) - return linkified.replace("\n", "
") + extensions = ["extra", "sane_lists", "nl2br"] + + try: + md = markdown.Markdown( + extensions=extensions + ["linkify"], + output_format="html5", + ) + except ModuleNotFoundError: + md = markdown.Markdown(extensions=extensions, output_format="html5") + + formatted = md.convert(escaped) + md.reset() + return formatted def build_colophon(): @@ -56,12 +66,12 @@ def get_most_recent_date(page_data): +
+

tools.mathspp.com colophon

+

The tools on tools.mathspp.com were mostly built using AI-assisted programming. This page lists {tool_count} tools and their development history.

+

This page lists the commit messages for each tool.

+
-
-

tools.mathspp.com colophon

-

The tools on tools.mathspp.com were mostly built using AI-assisted programming. This page lists {tool_count} tools and their development history.

-

This page lists the commit messages for each tool.

-
"""