From 9b3971a5d54a08b22f8e526c912c761da92479a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Ivan=C4=8Di=C4=87?= Date: Fri, 10 Oct 2025 10:38:58 +0200 Subject: [PATCH] Remove .md before adding .html to links --- mk_docs.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mk_docs.py b/mk_docs.py index a753df36..352adc13 100755 --- a/mk_docs.py +++ b/mk_docs.py @@ -1,4 +1,4 @@ -#! /bin/python3 +#!/bin/python3 import markdown import glob @@ -28,7 +28,11 @@ def md2html(md_file, html_file, file_name): if not a['href'].startswith(('http://', 'https://', '#')): if not a['href'].endswith(('html')): - a['href'] = a['href']+".html" + href = a['href'] + # Handle case when href is a link to another markdown file (commonly used in repositories). + if href.endswith('.md'): + href = href[:-3] + a['href'] = href + '.html' if (str(a['href']).find(":") > 0): a['href'] = a['href'].replace(":", "/")