use markdown_render.nu # Render a Markdown file using the first available terminal renderer. export def main [file: path] { if not (which mdcat | is-empty) { mdcat $file; return } if not (which glow | is-empty) { glow $file; return } if not (which bat | is-empty) { bat --no-pager $file; return } open $file } # Render a file or piped Markdown using only Nushell; unsupported syntax stays literal. export def render [file?: path --width: int = 80] { let input = $in if $file == null { $input | markdown_render --width $width } else { markdown_render $file --width $width } }