From d619bafb8dd0ad0d75c31b6517c3a4e61c71a95f Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sat, 9 May 2026 13:51:55 +0200 Subject: [PATCH] People use tabs, I guess --- RNS/Utilities/rngit/pages.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RNS/Utilities/rngit/pages.py b/RNS/Utilities/rngit/pages.py index 3a1810e6..fbbc35c7 100644 --- a/RNS/Utilities/rngit/pages.py +++ b/RNS/Utilities/rngit/pages.py @@ -98,6 +98,10 @@ class NomadNetworkNode(): CLR_DIM = "`F666" CLR_DIM_H = "`F444" + # Yes, I'm being intentionally weird here. If you + # want to use tabs, three spaces is all you get. + TAB_WIDTH = " " + RENDERABLE_EXTS = [".md", ".mu"] RENDER_DEFAULT = [".md", ".mu"] @@ -244,6 +248,7 @@ class NomadNetworkNode(): return None def render_template(self, page_content, nav_content=None, template=None, st=None): + page_content = self.format_tabs(page_content) custom_template = self.get_template(template) if template else None if custom_template: template = custom_template @@ -2086,6 +2091,10 @@ class NomadNetworkNode(): years = int(diff / 31536000) return f"{years} year{'s' if years != 1 else ''} ago" + def format_tabs(self, text): + if text == None: return None + else: return text.replace("\t", self.TAB_WIDTH) + def format_diff(self, diff_text: str) -> str: lines = diff_text.split("\n") formatted_lines = []