Skip to content

Python tool for converting files and office documents to Markdown.

Don't generate md links in 'pre' blocks (#322)

Tomasz Kalinowski3a5ca22a8df7
diff --git a/packages/markitdown/src/markitdown/converters/_markdownify.py b/packages/markitdown/src/markitdown/converters/_markdownify.py
index 5b6d7394..e15f6070 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")