Merge pull request 'Auto-commit local changes before build (2026-01-13 10:21:27)' (#106) from v20260113-01-changelog-markdown-render into main

Reviewed-on: #106
This commit is contained in:
Ivo Oskamp 2026-01-13 11:47:54 +01:00
commit b17608c3c5
6 changed files with 77 additions and 4 deletions

View File

@ -1 +1 @@
v20260112-18-changelog-from-gitea
v20260113-01-changelog-markdown-render

View File

@ -7,3 +7,4 @@ python-dateutil==2.9.0.post0
gunicorn==23.0.0
requests==2.32.3
reportlab==4.2.5
Markdown==3.6

View File

@ -1,5 +1,7 @@
from .routes_shared import * # noqa: F401,F403
import markdown
GITEA_CHANGELOG_RAW_URL = (
"https://gitea.oskamp.info/ivooskamp/backupchecks/raw/branch/main/docs/changelog.md"
@ -11,6 +13,7 @@ GITEA_CHANGELOG_RAW_URL = (
@roles_required("admin", "operator", "reporter", "viewer")
def changelog_page():
changelog_md = ""
changelog_html = ""
error = None
try:
@ -22,12 +25,24 @@ def changelog_page():
if resp.status_code != 200:
raise RuntimeError(f"HTTP {resp.status_code}")
changelog_md = resp.text or ""
changelog_html = markdown.markdown(
changelog_md,
extensions=[
"fenced_code",
"tables",
"sane_lists",
"toc",
],
output_format="html5",
)
except Exception as exc: # pragma: no cover
error = f"Unable to load changelog from Gitea ({GITEA_CHANGELOG_RAW_URL}): {exc}"
return render_template(
"main/changelog.html",
changelog_md=changelog_md,
changelog_html=changelog_html,
changelog_error=error,
changelog_source_url=GITEA_CHANGELOG_RAW_URL,
)

View File

@ -34,3 +34,56 @@ main.dashboard-container {
white-space: normal;
cursor: text;
}
/* Markdown rendering (e.g., changelog page) */
.markdown-content {
overflow-wrap: anywhere;
}
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
margin-top: 1.25rem;
margin-bottom: 0.75rem;
}
.markdown-content p {
margin-bottom: 0.75rem;
}
.markdown-content ul,
.markdown-content ol {
margin-bottom: 0.75rem;
}
.markdown-content pre {
padding: 0.75rem;
border-radius: 0.5rem;
background: rgba(0, 0, 0, 0.05);
overflow: auto;
}
.markdown-content code {
font-size: 0.95em;
}
.markdown-content table {
width: 100%;
margin-bottom: 1rem;
}
.markdown-content table th,
.markdown-content table td {
padding: 0.5rem;
border-top: 1px solid rgba(0, 0, 0, 0.15);
}
.markdown-content blockquote {
border-left: 0.25rem solid rgba(0, 0, 0, 0.15);
padding-left: 0.75rem;
margin-left: 0;
color: rgba(0, 0, 0, 0.7);
}

View File

@ -23,8 +23,8 @@
<div class="card">
<div class="card-body">
{% if changelog_md %}
<pre class="mb-0" style="white-space: pre-wrap; word-break: break-word;">{{ changelog_md }}</pre>
{% if changelog_html %}
<div class="markdown-content">{{ changelog_html | safe }}</div>
{% else %}
<div class="text-body-secondary">No changelog content available.</div>
{% endif %}

View File

@ -1,5 +1,9 @@
## v20260113-01-changelog-markdown-render
- Updated the changelog route to render remote Markdown content with proper formatting.
- Enabled Markdown parsing so headings, lists, links, and code blocks are displayed as intended.
- Ensured the changelog always fetches the latest version from the source repository at request time.
- Removed plain-text rendering to prevent loss of Markdown structure.
================================================================================================================================================
## v0.1.20