From 39b929f863c78bc6c92fbd5c652a4e934b5a2a62 Mon Sep 17 00:00:00 2001 From: Gabor Melis Date: Tue, 2 Jun 2026 14:55:58 +0200 Subject: [PATCH] do not escape characters in :LINKs when printing to :MARKDOWN Everything that had to be escaped must have been already URL encoded for it to be parsed. This improves Markdown parse-print consistency. --- markdown-printer.lisp | 3 ++- tests/printing/inline.lisp | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/markdown-printer.lisp b/markdown-printer.lisp index d71e949..fcfba18 100644 --- a/markdown-printer.lisp +++ b/markdown-printer.lisp @@ -118,7 +118,8 @@ (defmethod print-md-tagged-element ((tag (eql :link)) stream rest) (format stream "<") - (dolist (a rest) (print-md-element a stream)) + (let ((*md-inline-chars-to-escape* "")) + (dolist (a rest) (print-md-element a stream))) (format stream ">")) (defmethod print-md-tagged-element ((tag (eql :mailto)) stream rest) diff --git a/tests/printing/inline.lisp b/tests/printing/inline.lisp index b584185..5bd2a6e 100644 --- a/tests/printing/inline.lisp +++ b/tests/printing/inline.lisp @@ -158,3 +158,8 @@ " :expected "\\inlinelatexormathjax{arg} ") + +(def-print-test do-not-escape-md-chars-in-urls + :format :markdown + :text "" + :expected "")