From 3a5ca22a8df772ef37c2caa41198468442de4dbc Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Tue, 11 Feb 2025 10:13:17 -0500 Subject: [PATCH] Don't generate md links in 'pre' blocks (#322) --- packages/markitdown/src/markitdown/converters/_markdownify.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/markitdown/src/markitdown/converters/_markdownify.py b/packages/markitdown/src/markitdown/converters/_markdownify.py index 5b6d739..e15f607 100644 --- a/packages/markitdown/src/markitdown/converters/_markdownify.py +++ b/packages/markitdown/src/markitdown/converters/_markdownify.py @@ -33,6 +33,10 @@ class _CustomMarkdownify(markdownify.MarkdownConverter): prefix, suffix, text = markdownify.chomp(text) # type: ignore if not text: return "" + + if el.find_parent("pre") is not None: + return text + href = el.get("href") title = el.get("title")