pub fn csv_to_markdown<R: Read>(input: R, config: Config) -> Result<String>Expand description
Convert CSV data to a Markdown table string.
This function reads CSV data from the provided reader and converts it to a Markdown table format. It processes the data in a streaming fashion to handle large files efficiently.
§Arguments
input- A reader containing CSV dataconfig- Configuration options for the conversion
§Returns
A string containing the formatted Markdown table.
§Errors
Returns CsvMdError if:
- The input cannot be read
- The CSV data is malformed
- Memory allocation fails during processing
§Example
use csvmd::{csv_to_markdown, Config};
use std::io::Cursor;
let csv_data = "Name,Age\nJohn,25\nJane,30";
let input = Cursor::new(csv_data);
let config = Config::default();
let result = csv_to_markdown(input, config)?;
assert!(result.contains("| Name | Age |"));