Skip to content
项目

关于

man-page inspired Markdown viewer

开发工具

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

mandown - mdn

A man-page inspired Markdown pager written in C.

Name change: executable's name changed to mdn

What is it

Need to lookup things from README? Or from manual page? Or perhaps just want to install something cool...

Update

  • More text format configs
    • supported blocks: heading, code, url, quote block,
    • configurable
      • indent
      • color
      • background
      • bold, italic, underline, dim
      • prefix (for quote block)
  • Using confini filetype as config file (using libconfig for processing)

See example config mdnrc for more details.

Sample

screenshot

Library dependency

Mandown requires libncurses(w), libxml2 and libconfig as compile-time dependencies.

Make sure you have them installed before compiling.

Debian

apt-get install libncursesw5-dev
apt-get install libxml2-dev
apt-get install libconfig-dev

Installation

Current version is still being developed for some HTML tags. However, it should work on most Markdown documents.

Homebrew

brew install mandown

The installed binary mdn would be at /usr/local/bin/

Debian

Third Party Repo

Install at your own discretion. See Debian project philosophy regarding third-party repositories.

pkg.haus

Mandown is available from the pkg.haus APT archive for Debian stable, testing and unstable on amd64 and arm64. Set up the archive per the instructions on pkg.haus, then run:

$ sudo apt install mandown

The installed binary mdn would be at /usr/bin/

Local

git clone https://github.com/Titor8115/mandown.git
cd mandown
make install

To remove the binary, you can run the commands below, or remove manually.

cd mandown
make uninstall

If you just want to compile and test it.

cd mandown
make

Feel free to create an issue.

Usage

Check out the new sample

mdn sample.md

Mouse scrolling is supported! (if your terminal emulator allows)

Move Up: Up, k

Move Down: Down, j

Page Up: Space, PgUp, b

Page Down: Bksp, PgDn, f

Show href in hyperlink: Tab + Enter, or double click mouse 1

Exit: q

To read detailed usage, run mdn -h

Embedding

Mandown can also be embedded in your own applications. To render a Markdown document in a C string:

#include "mandown.h"

char *str ="# Heading\n\nThis is some **BOLD** *italic* ***EMPHASIZED*** text.";
render_str(str, "md", "Test Title", NULL);

To render a Markdown document file:

#include "mandown.h"

FILE *fp = fopen("README.md", "r");
render_file(fp, "md", "Test file", NULL);

Static and shared libraries are available. Make sure you have installed the dependencies listed in Library dependency below, then assuming you installed Mandown under /usr/local:

# static build
gcc -o myprog -I/usr/local/include myprog.c /usr/local/lib/mandown.a -lncurses -lxml2 -lconfig
# shared build
gcc -o myprog -I/usr/local/include myprog.c -L/usr/local/lib -lmandown -lncurses -lxml2 -lconfig

tests

Todo

  • Line fold/wrap on white space
  • Optimized resizing
  • Makefile makeover
  • Add more config options
  • Table and contents rendering

探索相关项目

加载中…