Skip to content

Instantly share code, notes, and snippets.

View matouskozak's full-sized avatar

Matous Kozak matouskozak

View GitHub Profile
# Helper function to create markdown fenced code blocks robustly
def _create_fenced_block(content, language_hint=""):
if content is None:
content = "" # Ensure content is not None
content_str = str(content) # Ensure content is a string
fence_char = '`'
# Find the longest run of backticks in the content.
# Use one more than that for the fence, with a minimum of 3.