stagit

Personal Stagit Fork
commit 62010429c33b33ef1239638b202a745ea29e43a1
parent 596583a9a0ee852f1093b72eb4ffb77dec4fdfd9
Author: maydayv7 <maydayv7@gmail.com>
Date:   Mon,  5 Jan 2026 01:37:11 +0530

feat: Improve Markdown render

Diffstat:
MREADME.md | 4+++-
Mflake.nix | 11+++++++++++
Mrender.py | 23++++++++++++++++-------
3 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md @@ -13,7 +13,9 @@ This is my personal [fork](https://git.codemadness.org/stagit/) of `stagit`. - Pages are now styled by the `style.css` present at root - Sort repositories by last commit time on `index` page - Use local system timezone -- Added code syntax highlighting and Markdown rendering using [`render.py`](./render.py) +- Custom rendering with [`render.py`](./render.py): + - Code syntax highlighting with [Pygments](https://pygments.org/) + - Markdown rendering using [Python-Markdown](https://github.com/Python-Markdown/markdown) ## Usage diff --git a/flake.nix b/flake.nix @@ -16,6 +16,17 @@ pygments markdown pymdown-extensions + (buildPythonPackage rec { + pname = "markdown_callouts"; + version = "0.4.0"; + format = "pyproject"; + nativeBuildInputs = [ hatchling ]; + propagatedBuildInputs = [ markdown ]; + src = fetchPypi { + inherit pname version; + sha256 = "sha256-ftLJBIaWcFinOlR3gRIZg4OVItZwQa5SxJeWFvGyt0Y="; + }; + }) ] ); in diff --git a/render.py b/render.py @@ -24,18 +24,27 @@ if lexer is None: rendered = None if lexer.__class__ is pygments.lexers.MarkdownLexer: from markdown import markdown + from markdown_callouts.github_callouts import GitHubCalloutsExtension rendered = markdown( contents, extensions=[ - "codehilite", - "extra", - "sane_lists", - "smarty", - "pymdownx.tasklist", - "pymdownx.arithmatex", + "markdown.extensions.tables", # Standard GFM Tables + "pymdownx.arithmatex", # Math support + "pymdownx.betterem", # Handle bold/italic like GFM + "pymdownx.magiclink", # Auto-link URLs + "pymdownx.superfences", # Syntax highlighting + "pymdownx.tasklist", # [x] Task lists + "pymdownx.tilde", # Support ~~strikethrough~~ + GitHubCalloutsExtension(), # GFM Alerts ], - extension_configs={"pymdownx.arithmatex": {"generic": True}}, + extension_configs={ + "pymdownx.arithmatex": {"generic": True}, + "pymdownx.magiclink": { + "repo_url_shortener": True, + "repo_url_shorthand": True, + }, + }, ) FORMAT = HtmlFormatter(