From e0c25cc0fe758c315366a0196909dc190d07afac Mon Sep 17 00:00:00 2001 From: Arseny <20096ninja@gmail.com> Date: Tue, 25 Aug 2026 16:14:18 +0300 Subject: [PATCH] =?UTF-8?q?[FIX]=20TOC=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D0=B2?= =?UTF-8?q?=D0=B5=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F/=D0=B7=D0=B0=D0=BA=D0=BB?= =?UTF-8?q?=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D1=8F/=D0=B8=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D1=87=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2=20=D0=B8=20=D1=83=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=8C=D1=88=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=88=D1=80?= =?UTF-8?q?=D0=B8=D1=84=D1=82=D0=B0=20=D0=B8=D0=BD=D0=BB=D0=B0=D0=B9=D0=BD?= =?UTF-8?q?-=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- md2gost/handlers/heading.py | 4 ++++ md2gost/handlers/inline.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/md2gost/handlers/heading.py b/md2gost/handlers/heading.py index 5563cf1..62aff4a 100644 --- a/md2gost/handlers/heading.py +++ b/md2gost/handlers/heading.py @@ -41,9 +41,13 @@ def heading(r, tok: Token) -> str: prefix = "" if upper in NEWPAGE_BEFORE: prefix = "\\clearpage\n" + toc_entry = "" + if upper in NEWPAGE_BEFORE: + toc_entry = f"\n\\phantomsection\\addcontentsline{{toc}}{{section}}{{{text}}}" return ( f"{prefix}" f"{{\\fontsize{{14pt}}{{18pt}}\\selectfont \\bfseries \\centering {text}\\par}}" + f"{toc_entry}" ) if level == 1: diff --git a/md2gost/handlers/inline.py b/md2gost/handlers/inline.py index 2473545..fbf51c6 100644 --- a/md2gost/handlers/inline.py +++ b/md2gost/handlers/inline.py @@ -59,7 +59,7 @@ def _em_close(tok: Token) -> str: @inline("code_inline") def _code_inline(tok: Token) -> str: - return f"\\verb|{tok.content}|" + return f"\\texttt{{\\small {escape_latex(tok.content)}}}" @inline("link_open")