From e004a5275cc64636444f2c4d6006648e2985f597 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 12 Feb 2021 21:32:41 -0700 Subject: [PATCH] Markdown.pl: do not leave remnant state lying around When commit c86fea4089ffa6f22204e8192ce8d73a13e15cc6 ("Markdown: enhance link handling", 2019-10-20, markdown_1.1.8) did its thing, a new global (%g_anchors_id) was introduced to keep track of all the link ids being used/generated in order to better connect them up to the links meant to target them. Unfortunately, that hash was not getting cleared before processing each new document. While this is mostly not a problem when running from the command line since typically only one document ever gets processed at once, if more than one document is processed at a time, prior documents could affect the link fragment targets for subsequent documents. Correct the problem by properly resetting the global (along with all the others that are also reset) before processing a new document. Signed-off-by: Kyle J. McKay --- Markdown.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/Markdown.pl b/Markdown.pl index 2c51364..0ef5fdc 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -1040,6 +1040,7 @@ sub Markdown { %g_urls = (); %g_titles = (); %g_anchors = (); + %g_anchors_id = (); %g_block_ids = (); %g_code_block_ids = (); %g_html_blocks = ();