Skip to content
Proyectos

Acerca de

man-page inspired Markdown viewer

Herramientas de desarrollo

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

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

Explorar proyectos relacionados

Cargando…