Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions mk_docs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/python3
#!/bin/python3

import markdown
import glob
Expand Down Expand Up @@ -28,8 +28,12 @@ def md2html(md_file, html_file, file_name):

if not a['href'].startswith(('http://', 'https://', '#')):
parts = a['href'].split('#')
if not parts[0].endswith(('html')):
a['href'] = parts[0] + ".html"
href = parts[0]
if not href.endswith(('html')):
# 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 (len(parts) > 1):
a['href'] = a['href'] + '#' + parts[1]
Expand Down