From 53ec48e6c3a0bb375d4877fa3916cfbd8334c86a Mon Sep 17 00:00:00 2001 From: Matthew Nemeth <44307920+mnemeth66@users.noreply.github.com> Date: Mon, 11 Mar 2024 18:04:23 -0700 Subject: [PATCH] prepend 'user-content-' to in-text links to match the prepended 'user-content-' in link anchors when rendered by Github Pages --- parse_json_to_md.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/parse_json_to_md.py b/parse_json_to_md.py index 490d0ecc..93bcc584 100644 --- a/parse_json_to_md.py +++ b/parse_json_to_md.py @@ -37,7 +37,9 @@ def render_paper(paper_entry: dict, idx: int) -> str: def render_title_and_author(paper_entry: dict, idx: int) -> str: title = paper_entry["title"] authors = paper_entry["authors"] - paper_string = f"{idx}. [{title}](#link{idx})\n" + # Github Pages seems to prepend 'user-content-' to the above anchors, + # so adjust for that and prepend 'user-content' to the in-text links + paper_string = f"{idx}. [{title}](#user-content-link{idx})\n" paper_string += f'**Authors:** {", ".join(authors)}\n' return paper_string