From a7063e2c8217afbbdee119e752ced03fe1649429 Mon Sep 17 00:00:00 2001 From: Marcos Borges <205091563+MarcosBorgesPhD@users.noreply.github.com> Date: Thu, 20 Nov 2025 23:02:02 +0100 Subject: [PATCH 1/6] Fix Issue -> PR conversion of code blocks - Dedent before adding indentation - Add correct indentation --- scripts/auto-pr-helper.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/auto-pr-helper.py b/scripts/auto-pr-helper.py index b5454b98..0abcc7e5 100644 --- a/scripts/auto-pr-helper.py +++ b/scripts/auto-pr-helper.py @@ -3,7 +3,7 @@ import os import re import sys -from textwrap import indent +from textwrap import indent, dedent from m2r import convert @@ -85,9 +85,15 @@ def format_code_block(code: str, lang: str = "rust") -> str: lines = lines[1:] if lines and lines[-1].strip() == "```": lines = lines[:-1] + + # Dedent before adding indentation + dedented_code = dedent("\n".join(lines)) + + # Add required indentation indented_code = "\n".join( - f" {line}" for line in lines - ) # Adds the required indentation + f" {line}" for line in dedented_code.splitlines() + ) + return f"\n\n{indented_code}\n" amplification_text = indent(md_to_rst(get("amplification")), " " * 12) From a20c04c5cc3fc9e0c39c5e7c8d61b3713368ae84 Mon Sep 17 00:00:00 2001 From: Marcos Borges <205091563+MarcosBorgesPhD@users.noreply.github.com> Date: Thu, 20 Nov 2025 21:56:56 +0100 Subject: [PATCH 2/6] Fix: Normalize Markdown links and formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Convert inline-code links like [`text`](url) to standard [text](url) - Correct mixed bold/code formatting: - **`code`** → `code` - `**code**` → `code` This prevents Markdown parser errors in issue bodies and ensures consistent formatting. --- scripts/auto-pr-helper.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/scripts/auto-pr-helper.py b/scripts/auto-pr-helper.py index 0abcc7e5..8024d17e 100644 --- a/scripts/auto-pr-helper.py +++ b/scripts/auto-pr-helper.py @@ -21,6 +21,34 @@ def md_to_rst(markdown: str) -> str: return convert(markdown) +def normalize_md(issue_body: str) -> str: + """ + Fix links and mixed bold/code that confuse Markdown parser + """ + # Fix links with inline-code: [`link`](url) => [link](url) + issue_body = re.sub( + r"\[\s*`([^`]+)`\s*\]\(([^)]+)\)", + r"[\1](\2)", + issue_body + ) + + # Fix mixed bold/code formatting + # **`code`** => `code` + issue_body = re.sub( + r"\*\*`([^`]+)`\*\*", + r"`\1`", + issue_body + ) + + # `**code**` => `code` + issue_body = re.sub( + r"`\*\*([^`]+)\*\*`", + r"`\1`", + issue_body + ) + + return issue_body + def extract_form_fields(issue_body: str) -> dict: """ @@ -145,7 +173,10 @@ def format_code_block(code: str, lang: str = "rust") -> str: issue_number = json_issue["number"] issue_title = json_issue["title"] + issue_body = json_issue["body"] + issue_body = normalize_md(issue_body) + fields = extract_form_fields(issue_body) chapter = fields["chapter"] content = guideline_template(fields) From 8e476b44f6688f067e5315f37eee71ec8ac3a23e Mon Sep 17 00:00:00 2001 From: Marcos Borges <205091563+MarcosBorgesPhD@users.noreply.github.com> Date: Fri, 21 Nov 2025 00:34:12 +0100 Subject: [PATCH 3/6] Fix: address CI failure by updating snapshot-ci.yml --- .github/workflows/snapshot-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/snapshot-ci.yml b/.github/workflows/snapshot-ci.yml index 8631545d..a5fe40b1 100644 --- a/.github/workflows/snapshot-ci.yml +++ b/.github/workflows/snapshot-ci.yml @@ -18,6 +18,9 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v6 + - name: Install Pandoc + uses: jgm/pandoc-action@v2 + - name: Run snapshot tests run: | uv run python .github/auto-pr-tests/test_runner.py From 231862424f00e19978e9f66eec403ebdd16ee351 Mon Sep 17 00:00:00 2001 From: Marcos Borges <205091563+MarcosBorgesPhD@users.noreply.github.com> Date: Fri, 21 Nov 2025 01:07:16 +0100 Subject: [PATCH 4/6] Fix: address CI failure by updating Pandoc installation --- .github/workflows/auto-pr-on-issue.yml | 3 +++ .github/workflows/snapshot-ci.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-pr-on-issue.yml b/.github/workflows/auto-pr-on-issue.yml index 49a83653..8c62e9e3 100644 --- a/.github/workflows/auto-pr-on-issue.yml +++ b/.github/workflows/auto-pr-on-issue.yml @@ -26,6 +26,9 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v6 + - name: Install Pandoc + uses: pandoc/actions/setup@v1 + - name: Set up Git run: | git config --global user.email "action@github.com" diff --git a/.github/workflows/snapshot-ci.yml b/.github/workflows/snapshot-ci.yml index a5fe40b1..aaf73754 100644 --- a/.github/workflows/snapshot-ci.yml +++ b/.github/workflows/snapshot-ci.yml @@ -19,7 +19,7 @@ jobs: uses: astral-sh/setup-uv@v6 - name: Install Pandoc - uses: jgm/pandoc-action@v2 + uses: pandoc/actions/setup@v1 - name: Run snapshot tests run: | From 727ab69ee5da64af4d30bd25ea3a148ab23aa04e Mon Sep 17 00:00:00 2001 From: Marcos Borges <205091563+MarcosBorgesPhD@users.noreply.github.com> Date: Tue, 2 Dec 2025 19:05:41 +0100 Subject: [PATCH 5/6] Fix import order in auto-pr-helper.py (ruff I001) Resolve ruff lint error I001 that was preventing the build. --- scripts/auto-pr-helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/auto-pr-helper.py b/scripts/auto-pr-helper.py index 8024d17e..de09de6b 100644 --- a/scripts/auto-pr-helper.py +++ b/scripts/auto-pr-helper.py @@ -3,7 +3,7 @@ import os import re import sys -from textwrap import indent, dedent +from textwrap import dedent, indent from m2r import convert From b43235357e436f5b5f4f4ac66f223e900e692110 Mon Sep 17 00:00:00 2001 From: Marcos Borges <205091563+MarcosBorgesPhD@users.noreply.github.com> Date: Tue, 2 Dec 2025 20:41:56 +0100 Subject: [PATCH 6/6] Keep Pandoc installation out of this PR. --- .github/workflows/auto-pr-on-issue.yml | 3 --- .github/workflows/snapshot-ci.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/auto-pr-on-issue.yml b/.github/workflows/auto-pr-on-issue.yml index 8c62e9e3..49a83653 100644 --- a/.github/workflows/auto-pr-on-issue.yml +++ b/.github/workflows/auto-pr-on-issue.yml @@ -26,9 +26,6 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v6 - - name: Install Pandoc - uses: pandoc/actions/setup@v1 - - name: Set up Git run: | git config --global user.email "action@github.com" diff --git a/.github/workflows/snapshot-ci.yml b/.github/workflows/snapshot-ci.yml index aaf73754..8631545d 100644 --- a/.github/workflows/snapshot-ci.yml +++ b/.github/workflows/snapshot-ci.yml @@ -18,9 +18,6 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v6 - - name: Install Pandoc - uses: pandoc/actions/setup@v1 - - name: Run snapshot tests run: | uv run python .github/auto-pr-tests/test_runner.py