extract_code_block_or_original

Function extract_code_block_or_original 

Source
pub fn extract_code_block_or_original(input: &str) -> String
Expand description

Returns the contents of the first fenced Markdown code block if present, otherwise returns the original input unchanged.

This is a convenience wrapper around extract_code_block that guarantees a String result, making it useful when a fallback value is required.

§Arguments

  • input - The input string that may contain a fenced code block.

§Returns

  • The extracted code block contents if found
  • Otherwise, the original input converted to a String