Skip to main content

Module utils

Module utils 

Source
Expand description

Utility functions for babyrite.

Functions§

defuse_code_fences
Rewrites text so it cannot terminate a Discord code fence.
escape_markdown
Escapes text so Discord renders it literally, on a single line.
fence_info
Returns language for use as a code fence’s info string, or an empty info string when language contains a backtick.
inline_code
Formats text as inline code, or as escaped plain text when it contains a backtick.
language_for_path
Returns the language identifier for syntax highlighting based on a file path.
language_from_extension
Returns the language identifier for syntax highlighting based on file extension.
language_from_filename 🔒