MCPcopy Create free account
hub / github.com/Noumena-Network/code / render_fenced_code

Function render_fenced_code

native/markdown-renderer-napi/src/lib.rs:6–14  ·  view source on GitHub ↗
(code: String, options: Option<JsObject>)

Source from the content-addressed store, hash-verified

4
5#[napi(js_name = "renderFencedCode")]
6pub fn render_fenced_code(code: String, options: Option<JsObject>) -> Option<Vec<String>> {
7 let width = options
8 .as_ref()
9 .and_then(|opts| opts.get_named_property::<u32>("terminalWidth").ok())
10 .filter(|&w| w > 0)
11 .unwrap_or(80);
12
13 Some(wrap_with_width(&code, width as usize))
14}
15
16fn wrap_with_width(code: &str, width: usize) -> Vec<String> {
17 let width = width.max(1);

Callers

nothing calls this directly

Calls 1

wrap_with_widthFunction · 0.85

Tested by

no test coverage detected