Skip to main content

Crate mdcat

Crate mdcat 

Source
Expand description

mdcat: render markdown to TTYs.

This crate exposes both the command-line interface entry points and the core rendering library (previously published as pulldown-cmark-mdcat). See push_tty for the main library entry point, and process_file for the CLI-level helper that reads markdown from a file and renders it to the given Output.

§Features

  • default enables svg and image-processing.

  • svg includes support for rendering SVG images to PNG for terminals which do not support SVG images natively. This feature adds a dependency on resvg.

  • image-processing enables processing of pixel images before rendering. This feature adds a dependency on image. If disabled mdcat will not be able to render inline images on some terminals, or render images incorrectly or at wrong sizes on other terminals.

    Do not disable this feature unless you are sure that you won’t use inline images, or accept incomplete rendering of images. Please do not report issues with inline images with this feature disabled.

Re-exports§

pub use crate::resources::ResourceUrlHandler;
pub use crate::terminal::capabilities::TerminalCapabilities;
pub use crate::terminal::Multiplexer;
pub use crate::terminal::TerminalProgram;
pub use crate::terminal::TerminalSize;

Modules§

args
Argument parsing for mdcat. Command-line argument definitions for the mdcat multicall binary.
cli
Shared CLI entry point for the mdcat and mdless binaries. Shared CLI entry point for both binaries.
mdless
Interactive mdless viewer.
output
Output handling for mdcat.
resources
Access to resources referenced from markdown documents.
terminal
Terminal utilities.

Structs§

Environment
The environment to render markdown in.
NoopObserver
Observer that ignores every event.
Settings
Settings for markdown rendering.
Theme
A colour theme for mdcat.

Enums§

RenderError
Errors that occur while rendering markdown to a terminal.

Statics§

DEFAULT_RESOURCE_READ_LIMIT
Default read size limit for resources (100 MiB).

Traits§

RenderObserver
Observer invoked on every event the render state machine processes.

Functions§

create_resource_handler
Create the resource handler for mdcat.
markdown_options
CommonMark + the GFM extensions mdcat renders natively.
process_file
Process a single file.
push_tty
Write markdown to a TTY.
push_tty_with_observer
Render Markdown to a TTY while handing every event to an observer.
read_input
Read input for filename.

Type Aliases§

RenderResult
Result type used throughout the rendering library.