diff --git a/RNS/Utilities/rngit/highlight.py b/RNS/Utilities/rngit/highlight.py index d729f13a..0b8b0847 100644 --- a/RNS/Utilities/rngit/highlight.py +++ b/RNS/Utilities/rngit/highlight.py @@ -237,13 +237,23 @@ class MicronFormatter: if color and value: escaped = self._escape_value(value) - output_parts.append(f"`FT{color}{escaped}`f") + if escaped.startswith("\n"): ilb = "\n"; escaped = escaped[1:] + else: ilb = "" + if escaped.endswith("\n"): tlb = "\n"; escaped = escaped[:-1] + else: tlb = "" + output_parts.append(f"{ilb}`FT{color}{escaped}`f{tlb}") else: output_parts.append(self._escape_value(value)) prev_was_dot = is_dot - outfile.write("".join(output_parts)) + output = "".join(output_parts) + final_output = "" + for line in output.splitlines(): + if line.startswith(">"): line = f"`>{line}" + final_output += f"{line}\n" + + outfile.write(final_output) def _get_color_key_for_token(self, ttype): token_parts = [] diff --git a/RNS/Utilities/rngit/pages.py b/RNS/Utilities/rngit/pages.py index a78efe68..44c7ab66 100644 --- a/RNS/Utilities/rngit/pages.py +++ b/RNS/Utilities/rngit/pages.py @@ -709,14 +709,14 @@ class NomadNetworkNode(): content = self.get_blob_content(repo_path, resolved_ref, file_path) if content is not None: if renderable and render: - if file_ext == ".mu": content_parts.append(f"{content}\n") - elif file_ext == ".md": content_parts.append(f"{self.mdc.format_block(content)}\n") + if file_ext == ".mu": content_parts.append(f"{content.rstrip()}\n") + elif file_ext == ".md": content_parts.append(f"{self.mdc.format_block(content).rstrip()}\n") else : content_parts.append(f"`=\n{content}\n`=") else: if self.highlight_syntax: - highlighted = self.highlighter.highlight(content, file_path) - content_parts.append(highlighted) + highlighted = self.highlighter.highlight(content, file_path).rstrip() + content_parts.append(highlighted+"\n") else: content_parts.append(f"`=\n{content}\n`=") diff --git a/RNS/Utilities/rngit/util.py b/RNS/Utilities/rngit/util.py index 90f42d9e..51c11bb0 100644 --- a/RNS/Utilities/rngit/util.py +++ b/RNS/Utilities/rngit/util.py @@ -315,7 +315,7 @@ class MarkdownToMicron: content = match.group(2) level = len(hashes) prefix = ">" * min(level, 6) - return f"{prefix}{content}" + return f"{prefix}{self._format_inline(content)}" def _format_list_item(self, match): indent = match.group(1)