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 | |
| parent | 2a076517255c4585ac2bc475aaafdc728b6dae6f (diff) | |
| download | git2hugo-85da4abc206f2cc8819836bb0e8727de3a51d24c.tar.gz | |
g2h: Render markdown files instead of putting them into code blocks
Diffstat (limited to 'src')
| -rw-r--r-- | src/g2h/cli.py | 2 | ||||
| -rw-r--r-- | src/g2h/file_page.py | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/g2h/cli.py b/src/g2h/cli.py index fe3850c..bc59467 100644 --- a/src/g2h/cli.py +++ b/src/g2h/cli.py @@ -11,7 +11,7 @@ def parse_args(): parser.add_argument('--repo', help='Path to the root of git repository', default=os.getcwd()) parser.add_argument('--out', help='Path to where the generated files should be stored', default=os.getcwd()) # TODO: Add an actual default value. - parser.add_argument('--name', help='Name of the project. Default: directory name of repo') + parser.add_argument('--name', help='Name of the project. Default: directory name of repo (TODO)') parser.add_argument('--content-subdir', help='Subdir(s) where the page will be served from. Default: None', default='') return parser.parse_args() 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, |