diff options
| author | Christoph Schlosser <christoph@linux.com> | 2025-10-10 17:19:27 +0200 |
|---|---|---|
| committer | Christoph Schlosser <christoph@linux.com> | 2025-10-10 17:19:27 +0200 |
| commit | 85da4abc206f2cc8819836bb0e8727de3a51d24c (patch) | |
| tree | 6c4884cef49da8ccb1f21bc180d4b6a5681bd267 /src/g2h/file_page.py | |
| parent | 2a076517255c4585ac2bc475aaafdc728b6dae6f (diff) | |
| download | git2hugo-85da4abc206f2cc8819836bb0e8727de3a51d24c.tar.gz | |
g2h: Render markdown files instead of putting them into code blocks
Diffstat (limited to 'src/g2h/file_page.py')
| -rw-r--r-- | src/g2h/file_page.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/g2h/file_page.py b/src/g2h/file_page.py index d64cb84..f2e0550 100644 --- a/src/g2h/file_page.py +++ b/src/g2h/file_page.py @@ -38,8 +38,11 @@ class FilePage(Page): content, file_type = bytes_to_content(file_bytes) backtick_max = 2 if file_type == 'text': - matches = re.findall('`+', content) - backtick_max = max(max(len(match) for match in matches) if matches else 0, backtick_max) + if self.file_name.lower().endswith('.md'): + backtick_max = -1 + else: + matches = re.findall('`+', content) + backtick_max = max(max(len(match) for match in matches) if matches else 0, backtick_max) return { 'backtick_max': backtick_max + 1, |