Extract link to markdown conversion to a method

This commit is contained in:
Stanko K.R.
2025-08-14 15:20:10 +02:00
parent 10728e35ef
commit 94405f4a6a
@@ -14,6 +14,11 @@ module Conversation::Message::Promptable
end
def to_prompt
content.body.fragment.replace("a") { |link| "[#{link.text}](#{link["href"]})" }.to_plain_text
content.body.fragment.replace("a") { convert_link_to_markdown(it) }.to_plain_text
end
private
def convert_link_to_markdown(node)
"[#{node.text}](#{node["href"]})"
end
end