extract_code_block

Function extract_code_block 

Source
pub fn extract_code_block(input: &str) -> Option<String>
Expand description

Extracts the first fenced Markdown code block from the input string.

This function looks for a triple-backtick (```) fenced code block and returns the contents inside it. If a language identifier is present (e.g. ```rust), it is skipped automatically.

§Arguments

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

§Returns

  • Some(String) containing the inner contents of the first code block
  • None if no fenced code block is found