Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jan 10, 2025. It is now read-only.
/mdcatPublic archive

cat for markdown

License

NotificationsYou must be signed in to change notification settings

swsnr/mdcat

Repository files navigation

mdcat

Fancycat for Markdown (that is,CommonMark):

$ mdcat sample.md

mdcat showcase with different colour themes

mdcat inWezTerm, with "One Light (base16)", "Gruvbox Light", and "Darcula(base16)" (from left to right), andJetBrains Mono as font.

Features

mdcat works best withiTerm2,WezTerm, andkitty, and a good terminal font with italic characters.Then it

  • nicely renders all basic CommonMark syntax,
  • highlights code blocks withsyntect,
  • showslinks, and also images inline in supported terminals (see above, where "Rust" is a clickable link!),
  • adds jump marks for headings iniTerm2 (jump forwards and backwards with ⇧⌘↓ and ⇧⌘↑).
TerminalBasic syntaxSyntax highlightingImagesJump marks
Basic ANSI¹
Windows 10 console
Terminology
iTerm2✓²
kitty✓²
WezTerm✓²
VSCode✓²
Ghostty✓²
  1. mdcat requires that the terminal supports strikethrough formatting andinline links.This includes most modern terminal emulators, such as Windows Terminal, KDE Konsole, or anything based on VTE, GNOME's terminal emulation library.But mdcat likely won't work well on old terminals that lack these features (e.g. the Linux text console).
  2. SVG images are rendered withresvg, seeSVG support.

Not supported:

  • CommonMark extension for footnotes.
  • Inline markup and text wrapping in table cells.

Usage

Trymdcat --help or read themdcat(1) manpage.

Installation

mdcat can be linked or copied tomdless; if invoked asmdless it automatically uses pagination.

Building

Runcargo build --release.

Building requireslibcurl.

Packaging

When packagingmdcat you may wish to include the following additional artifacts:

  • A symlink or hardlink frommdless tomdcat (see above).

  • Shell completions for relevant shells, by invokingmdcat --completions after building, e.g.

    $mdcat --completions fish> /usr/share/fish/vendor_completions.d/mdcat.fish$mdcat --completions bash> /usr/share/bash-completion/completions/mdcat$mdcat --completions zsh> /usr/share/zsh/site-functions/_mdcat#Samefor mdlessif you include it$mdless --completions fish> /usr/share/fish/vendor_completions.d/mdless.fish$mdless --completions bash> /usr/share/bash-completion/completions/mdless$mdless --completions zsh> /usr/share/zsh/site-functions/_mdless
  • A build of the man pagemdcat.1.adoc, usingAsciiDoctor:

    $asciidoctor -b manpage -a reproducible -o /usr/share/man/man1/mdcat.1 mdcat.1.adoc$gzip /usr/share/man/man1/mdcat.1#If you include a mdless as above, you may also want to support man mdless$ln -s mdcat.1.gz /usr/share/man/man1/mdless.1.gz

Troubleshooting

mdcat can output extensive tracing information when asked to.Runmdcat with$MDCAT_LOG=trace for complete tracing information, or with$MDCAT_LOG=mdcat::render=trace to trace only rendering.

License

Copyright Sebastian Wiesnersebastian@swsnr.de

Binaries are subject to the terms of the Mozilla PublicLicense, v. 2.0, seeLICENSE.

Most of the source is subject to the terms of the Mozilla PublicLicense, v. 2.0, seeLICENSE, unless otherwise noted;some files are subject to the terms of the Apache 2.0 license,seehttp://www.apache.org/licenses/LICENSE-2.0


[8]ページ先頭

©2009-2025 Movatter.jp